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
Get step-by-step solutions from verified subject matter experts
