A furniture store specializes in office furniture and sells Office Chairs, Desks and Book Shelves. Customers can buy furniture using the application of the furniture shop. Create a class Furniture having id, finishing/polish, and price provide appropriate methods for the data members provide toString method and a method Buy which simply prints “Buying A Furniture”; as type of furniture is not specified. Next create class Chairs having fabric (String), arms (Boolean), as data members this extends the functionality of Furniture class. Provide appropriate methods for data members, also provide an override method Buy which helps customers buy the chair please note the following Arms are optional if customers wants to have armed chair then it will add extra cost of 1000 to the original price of chair otherwise price remains same. User can also change color of polish (options available brown, black and white). Price of black and brown are Rs 2,000 each whereas price of white chair is Rs 3,000. Ask user for quantity and then calculate the bill and display proper receipt to user. Then create class Desks having number of drawers as data member this also extends furniture class, provide appropriate methods and an override method Buy method which will calculate and display cost of buying desk to user, keep in mind For Desks having drawers more than 3 will add extra charges of 500 per drawer. User can also change color of polish (options available brown, black and white). Price of black and brown are Rs 2,000 each whereas price of white chair is Rs 3,000. Ask user for quantity and then calculate the bill and display proper receipt to user. There is Book Shelves inherited from Furniture class having number of Racks as data members. Provide appropriate methods and this also overrides Buy method of parent class which will calculate and display cost of buying desk to user, keep in mind For Shelves having racks more than 10 will add extra charges of 1500. User can also change color of polish (options available brown, black and white). Price of black and brown are Rs 2,000 each whereas price of white chair is Rs 3,000. Ask user for quantity and then calculate the bill and display proper receipt to user. Now in main class create an object array of Furniture type, create following menu Add Furniture View All Buy A furniture If user chooses 1st option then asks user for the type of furniture as Chairs Desks BookShelf Create the object of that type and add it to the array After that if user choses 2nd option then display all values. If user chooses the 3rd option again ask the user about type of furniture i.e. chairs, Desks or BookShelf he/she wants to Buy and then call appropriate Buy method of that particular class. This repeats until user presses 0 to exit the program. Note: You have to follow concepts of Inheritance and polymorphism. Rubric: Remember and Implement abstraction and encapsulation as proper implementation of both carries marks Implement Concept of Inheritance correctly. Implement the Polymorphism appropriately Provide Input Validation checks in the setters, for e.g price should not have negative value entered. Provide toString() method Provide main which implements the user interaction. Logic making Proper working code
A furniture store specializes in office furniture and sells Office Chairs, Desks and Book Shelves. Customers can buy furniture using the application of the furniture shop.
Create a class Furniture having id, finishing/polish, and price provide appropriate methods for the data members provide toString method and a method Buy which simply prints “Buying A Furniture”; as type of furniture is not specified.
Next create class Chairs having fabric (String), arms (Boolean), as data members this extends the functionality of Furniture class. Provide appropriate methods for data members, also provide an override method Buy which helps customers buy the chair please note the following
- Arms are optional if customers wants to have armed chair then it will add extra cost of 1000 to the original price of chair otherwise price remains same.
- User can also change color of polish (options available brown, black and white). Price of black and brown are Rs 2,000 each whereas price of white chair is Rs 3,000.
- Ask user for quantity and then calculate the bill and display proper receipt to user.
Then create class Desks having number of drawers as data member this also extends furniture class, provide appropriate methods and an override method Buy method which will calculate and display cost of buying desk to user, keep in mind
- For Desks having drawers more than 3 will add extra charges of 500 per drawer.
- User can also change color of polish (options available brown, black and white). Price of black and brown are Rs 2,000 each whereas price of white chair is Rs 3,000.
- Ask user for quantity and then calculate the bill and display proper receipt to user.
There is Book Shelves inherited from Furniture class having number of Racks as data members. Provide appropriate methods and this also overrides Buy method of parent class which will calculate and display cost of buying desk to user, keep in mind
- For Shelves having racks more than 10 will add extra charges of 1500.
- User can also change color of polish (options available brown, black and white). Price of black and brown are Rs 2,000 each whereas price of white chair is Rs 3,000.
- Ask user for quantity and then calculate the bill and display proper receipt to user.
Now in main class create an object array of Furniture type, create following menu
- Add Furniture
- View All
- Buy A furniture
If user chooses 1st option then asks user for the type of furniture as
- Chairs
- Desks
- BookShelf
Create the object of that type and add it to the array
After that if user choses 2nd option then display all values. If user chooses the 3rd option again ask the user about type of furniture i.e. chairs, Desks or BookShelf he/she wants to Buy and then call appropriate Buy method of that particular class. This repeats until user presses 0 to exit the program.
Note: You have to follow concepts of Inheritance and polymorphism.
Rubric:
- Remember and Implement abstraction and encapsulation as proper implementation of both carries marks
- Implement Concept of Inheritance correctly.
- Implement the Polymorphism appropriately
- Provide Input Validation checks in the setters, for e.g price should not have negative value entered.
- Provide toString() method
- Provide main which implements the user interaction.
- Logic making
- Proper working code
Step by step
Solved in 2 steps with 1 images