Question
(1): Create a class called Restaurant that includes: NumberOfOrders (int) that counts the number of orders. It can be accessed by all classes, and its
(1): Create a class called Restaurant that includes:
NumberOfOrders (int) that counts the number of orders. It can be accessed by all classes, and its value will be shared by all objects.
orderName (String). It can be accessed by this class only.
orderPrice (double). It can be accessed by this class only.
Constructor with arguments to initialize the variables.
Accessors (getters) for all required instance variables.
(2) The Bill class includes two methods: getBill and the main methods
getBill
This method receives an array of Restaurant object and calculates the bill price, then returns the amount as a double value.
main
Create an array of object from Restaurant with the following values:
order1 :
order Name : Rice
order Price : 30
order2:
order Name: Pasta
order Price: 40
(3) print the order information with the bill
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started