Dragon Inc. is one of the top toy manufacturers in China. In fact, they’re a pioneer in toy manufacturing. They started production at a time when few toys were being produced commercially. Hence, they dominated the market and became the leader in the toy production industry. They produce two kinds of toys i.. Cars and Helicopter. For that there is a Toy class which has name, price, Color as its private data members. Provide a default Constructor. Provide overloaded parameterized Constructors. Provide getters, and setters for the data members. In addition there are three methods Prepare () which is used to prepare a toy, package () which packs the toy in a wrapper, Label () which label the name & Price of the toy on the package. Now create subclass Car having speed, model as its data members, Helicopter having wings, engines as data members, Provide a default Constructor. Provide overloaded parameterized Constructors. Provide getters, and setters for the data members. In addition override the Parent class methods i.e. Prepare (), package () & Label (). Create another class name ToyStore which has Toy object, int quantity, and total bill, Provide a default Constructor. Provide overloaded parameterized Constructors. Provide getters, and setters for the data members. Provide a method Toy OrderToy(String name): This method will create the type of object user wants e.g. If user types car then you have to create a car object, set its values, call the methods i.e. prepare, package, label and return the object. Now in main class create object of ToyStore class, Ask the user for the type of Toy he she wants Car Helicopter Based on user’s choice call the orderToy method, Also ask about quantity of toys then calculate the total bill and displays on screen.
Dragon Inc. is one of the top toy manufacturers in China. In fact, they’re a pioneer in toy manufacturing. They started production at a time when few toys were being produced commercially. Hence, they dominated the market and became the leader in the toy production industry. They produce two kinds of toys i.. Cars and Helicopter.
For that there is a Toy class which has name, price, Color as its private data members.
- Provide a default Constructor.
- Provide overloaded parameterized Constructors.
- Provide getters, and setters for the data members.
- In addition there are three methods Prepare () which is used to prepare a toy, package () which packs the toy in a wrapper, Label () which label the name & Price of the toy on the package.
Now create subclass Car having speed, model as its data members, Helicopter having wings, engines as data members,
- Provide a default Constructor.
- Provide overloaded parameterized Constructors.
- Provide getters, and setters for the data members.
- In addition override the Parent class methods i.e. Prepare (), package () & Label ().
Create another class name ToyStore which has Toy object, int quantity, and total bill,
- Provide a default Constructor.
- Provide overloaded parameterized Constructors.
- Provide getters, and setters for the data members.
- Provide a method Toy OrderToy(String name):
This method will create the type of object user wants e.g. If user types car then you have to create a car object, set its values, call the methods i.e. prepare, package, label and return the object.
Now in main class create object of ToyStore class, Ask the user for the type of Toy he she wants
- Car
- Helicopter
Based on user’s choice call the orderToy method, Also ask about quantity of toys then calculate the total bill and displays on screen.
Step by step
Solved in 2 steps with 2 images