Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Having trouble with Dog class  RSS feed

 
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.
 
Saloon Keeper
Posts: 4734
52
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: 4734
52
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?
 
Master Rancher
Posts: 3276
33
  • 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: 4734
52
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
 
author
Sheriff
Posts: 23586
138
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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!