• Post Reply Bookmark Topic Watch Topic
  • New Topic

Having trouble with Dog class  RSS feed

 
Brent Cloete
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all, I am a java student and I am having a bit of trouble with one of my projects.

Below is my first class:



My 2nd class



My one demo program that i wrote works fine but i am having an issue on the second demo program. Write a program that reads in five pets of type Dog and displays the name and breed of all dogs that are over two years old and have not had their booster shots.

This is what I have so far:



Any help will be highly appreciated.
 
Carey Brown
Saloon Keeper
Posts: 3329
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you know about arrays, lists, and loops?

Ideally you have a list of Dogs that contains individual Dog instances and a loop that goes through the list looking for an instance that matches the search criteria.

Something like:
 
Brent Cloete
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for the reply. I do know about loops and arrays, the code i posted i were busy playing around with arrays but i am struggling to write a loop to check for the age and boostershots
 
Carey Brown
Saloon Keeper
Posts: 3329
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Would you post your current code that attempts to use an array?
 
Norm Radder
Rancher
Posts: 2240
28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also posted at: http://www.dreamincode.net/forums/topic/404542-java-class-dog/

Please be sure to tell everyone where you've posted questions to keep volunteers from wasting time posting to answered questions.
 
Carey Brown
Saloon Keeper
Posts: 3329
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Norm Radder wrote:Also posted at: http://www.dreamincode.net/forums/topic/404542-java-class-dog/

Please be sure to tell everyone where you've posted questions to keep volunteers from wasting time posting to answered questions.

Also at
https://stackoverflow.com/questions/44484378/dog-class-java-assignment
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

First, cows all around, to the cross post hunters...   .... And second, to the OP, cross posting is actually allowed on the ranch. We just have some requests regarding it. See this wiki link for the full description of the policy.

https://coderanch.com/wiki/660346/Forthright-Cross-Posting-Sites

Henry
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!