Q4. In a restaurant, whenever customers visit, they are provided with items from two categories, one category is fixed for every customer like water bottle, salad and another category is according to the list of items that the customer orders like number of biriyani plates, number of dosas etc. Now, write an abstract class fixedCategory having the price of the fixed items as data member and an abstract method complimentaryCost(). Write another derived class orderedCategory which will have price of the food items that the customer has ordered as instance variable and one method orderedltemsCost() which will calculate the cost of ordered items. Also implement the abstract method complimentaryCost() in this derived class to find the cost for complementary items. Assume the customer has ordered each food item only once. Write a java code to display the attributes from each of the classes creating proper instances and invoking the methods from another main class customerCost. Assume price of water bottle is 20, salad 80, Ibiriyani 450, dosa 150. Description Description Sample Input Sample Output Variables double bottle_price, salad_price, Bottle_price=20, Salad price=80 fixedCategory abstract class complimentaryCost() is abstract method complimentaryCost() is abstract method fixedCategory abstract class biriyani_price=450, orderedCategory derived concrete class Variable biriyani_price, dosa_price dosa_price=150 orderedltemsCost() is a concrete method which will add the cost of the food items cost of ordered items is 600 orderedCategory derived concrete class Give definition for the abstract method complimentaryCost()which will add the cost of the food items orderedCategory derived concrete class cost for complementary items is 100 customerCost is a public class where main function/method i written

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Don't copy paste i would downvote because of copied answer. 

 

Q4. In a restaurant, whenever customers visit, they are provided with items from two categories, one category is fixed for every customer like water bottle, salad and another category is according to the list
of items that the customer orders like number of biriyani plates, number of dosas etc.
Now, write an abstract class fixedCategory having the price of the fixed items as data member and an abstract method complimentaryCost().
Write another derived class orderedCategory which will have price of the food items that the customer has ordered as instance variable and one method orderedltemsCost() which will calculate the cost of
ordered items. Also implement the abstract method complimentaryCost() in this derived class to find the cost for complementary items. Assume the customer has ordered each food item only once.
Write a java code to display the attributes from each of the classes creating proper instances and invoking the methods from another main class customerCost. Assume price of water bottle is 20, salad 80,
biriyani 450, dosa 150.
Description
Description
Sample Input
Sample Output
Variables double bottle_price, salad_price,
Bottle_price=20,
Salad_price=80
fixedCategory abstract class
complimentaryCost() is abstract method
complimentaryCost() is abstract method
fixedCategory abstract class
biriyani_price-450,
dosa_price=150
orderedCategory derived concrete class
Variable biriyani_price, dosa_price
orderedCategory derived concrete class
orderedltemsCost() is a concrete method which
will add the cost of the food items
cost of ordered items is 600
Give definition for the abstract method
complimentaryCost()which will add the cost of the
food items
orderedCategory derived concrete class
cost for complementary items is 100
customerCost is a public class where main
function/method is written
Transcribed Image Text:Q4. In a restaurant, whenever customers visit, they are provided with items from two categories, one category is fixed for every customer like water bottle, salad and another category is according to the list of items that the customer orders like number of biriyani plates, number of dosas etc. Now, write an abstract class fixedCategory having the price of the fixed items as data member and an abstract method complimentaryCost(). Write another derived class orderedCategory which will have price of the food items that the customer has ordered as instance variable and one method orderedltemsCost() which will calculate the cost of ordered items. Also implement the abstract method complimentaryCost() in this derived class to find the cost for complementary items. Assume the customer has ordered each food item only once. Write a java code to display the attributes from each of the classes creating proper instances and invoking the methods from another main class customerCost. Assume price of water bottle is 20, salad 80, biriyani 450, dosa 150. Description Description Sample Input Sample Output Variables double bottle_price, salad_price, Bottle_price=20, Salad_price=80 fixedCategory abstract class complimentaryCost() is abstract method complimentaryCost() is abstract method fixedCategory abstract class biriyani_price-450, dosa_price=150 orderedCategory derived concrete class Variable biriyani_price, dosa_price orderedCategory derived concrete class orderedltemsCost() is a concrete method which will add the cost of the food items cost of ordered items is 600 Give definition for the abstract method complimentaryCost()which will add the cost of the food items orderedCategory derived concrete class cost for complementary items is 100 customerCost is a public class where main function/method is written
Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY