Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

arun ameriya  RSS feed

arun ameriya
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
Posts: 18702
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?
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!