This week's giveaway is in the Programmer Certification (OCPJP) forum.
We're giving away four copies of Java Mock Exams (software) and have David Mayer on-line!
See this thread for details.
Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

arun ameriya

 
arun ameriya
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
create a class toy collection that stores information about different toys in a toy shop. The information to be stored about a single toy is,

- toy identification as string
- name of the toy as string
- Short discription about the toy as string
- Price of the toy as float
- Quantity of the toy in hand as short integer


This class contains following methods,
- Constructor method that assigns user input values to above mantioned variables.
- main() method that creates array of 4 objects of toycollection class and that takes input for all about details from the user end
class method to check validity of Quantity and Price values. If all values are valid then create the object and display the details for all 4 toys.
- Method that checks validity of quentity and price. If the quentity is 0 or negitive then method should through a user defined exception with approriate message and come out of program. Similiry if the prize is 0 or negivity then it should through user defined exception with appropriate message and come out of the program.

- Method that displays all detail about a single toy in the following format, e.g. Here Total price should be calculated


Toy Identification : S-1
Toy Name : Small Scooter
Toy description : Ordenery 3 wheeler Scooter
Toy Price : 650.50
Quantity in hand : 3
Total price of Toys : 1951.50
 
Tim Holloway
Bartender
Posts: 18465
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, Arun, but are you looking for someone to do your homework?
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!