This week's giveaway is in the JDBC forum.
We're giving away four copies of Java Database Connections & Transactions (e-book only) and have Marco Behler on-line!
See this thread for details.
Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!
  • 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:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

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.
 
Bartender
Posts: 5854
57
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
Bartender
Posts: 5854
57
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
 
Rancher
Posts: 3354
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
Bartender
Posts: 5854
57
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
 
author
Posts: 23832
140
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
 
Any sufficiently advanced technology will be used as a cat toy. And this tiny ad contains a very small cat:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!