Create a program that includes the following requirements: Create a CoffeeOrder class Private class members for: order number ingredient constant double PRICEOFCOFFEE = 1.95 constant double price additives for ,

Create a program that includes the following requirements: Create a CoffeeOrder class Private class members for: order number ingredient constant double PRICEOFCOFFEE = 1.95 constant double price additives for , , , at respectively. double order price other class variables as needed Public class methods: a method to get the data for each individual CoffeeOrder object in the array of objects instantiated in Main. the CoffeeOrder get data method will present a menu that looks like the following: Pass the counter into the get data method by reference from Main. The get data method will implement a sentinel while loop that will take an uppercase Y character entry regardless of whether y or Y is entered. In the loop, present the menu, take and convert the selection and evaluate the selection based on the ingredient additive combination entered. Based on the additive combination you will determine the total price of the cup for the current coffee object by adding the indicated additive constant to the PRICEOFCOFFEE constant. If the selection was 1 then black coffee was selected and you assign the PRICEOFCOFFEE value to the total price for a cup. The while loop will continue to take new coffee object orders until an N or n is entered. Within the selection statements you will first set the order number class variable equal to the object array index counter passed into the method from Main. If an incorrect selection is made remember to prompt the user regarding the incorrect coffee selection and present the selection menu again. A display data method that will display the order number (make sure you display the order number + 1), the total order price, “This is what you requested to be put in your cup of coffee: “. Implement a selection structure to display the additives or black coffee as shown in the output example. In Main: Instantiate an array of 10 coffee order objects set the x array index to zero and the counter that will track the number of orders taken up to 10 and the loop sentinel variable to Y call the class method that will fill the CoffeeOrders array a sentinel loop with a sentinel variable that will be initialized to character Y and a conditional that will continue while the sentinel is not equal to ‘N’ or ‘n’ in the while loop while the sentinel is equal to Y, instantiate the coffee order object and assign it to the current coffee order array element call the current array element objects’ get data method, passing the counter that keeps track of the number of orders up to 10, by reference update the counter, update the x array index prompt the user to enter a y or Y for another cup of coffee (another coffee object) and when an n or N is entered terminate the loop. check if the array of coffee objects index equals 10, set the sentinal value to N to exit the loop (you can only create and assign 10 coffee objects to the array of objects Internal Documentation The class will contain the following methods: getData and displaydata as specified above. You are creating an array to hold 10 coffee objects. Each time you take an order in Main you have to instantiate that object and assign it to the appropriate array element. Remember that you can only create 10 coffee objects. The counter you pass by reference from Main to the get data method is used by the class method to set the order number for the get data method. Analyze the suggested inputs and outputs to gain further information about how the processes are run and how incorrect inputs are handled. 1 Do you want to order another cup of coffee? y You are ordering a fine cup of coffee. would you like in your coffee? 1. Black 2. Cream & Sugar, add 25 cents 3. Cream & Artificial Sweetener, add 40 cents 4. Milk & Sugar, add 30 cents 5. Milk & Artificial Sweetener, add 40 cents enter your selection from 1 to 5: 3 Do you want to order another cup of coffee? Y You are ordering a fine cup of coffee. would you like in your coffee? 1. Black 2. Cream & Sugar, add 25 cents 3. Cream & Artificial Sweetener, add 40 cents 4. Milk & Sugar, add 30 cents 5. Milk & Artificial Sweetener, add 40 cents enter your selection from 1 to 5: 8 You entered an incorrect selection, try again. You are ordering a fine cup of coffee. would you like in your coffee? 1. Black 2. Cream & Sugar, add 25 cents 3. Cream & Artificial Sweetener, add 40 cents 4. Milk & Sugar, add 30 cents 5. Milk & Artificial Sweetener, add 40 cents enter your selection from 1 to 5: 4 Do you want to order another cup of coffee? y You are ordering a fine cup of coffee. would you like in your coffee? 1. Black 2. Cream & Sugar, add 25 cents 3. Cream & Artificial Sweetener, add 40 cents 4. Milk & Sugar, add 30 cents 5. Milk & Artificial Sweetener, add 40 cents enter your selection from 1 to 5: 5 Do you want to order another cup of coffee? N Order Number: 1 Amount of Order: 1.95 This is what you requested to be put in your cup of coffee: Black and nothing else Order Number: 2 Amount of Order: 2.35 This is what you requested to be put in your cup of coffee: Cream & Artificial Sweetener Order Number: 3 Amount of Order: 2.25 This is what you requested to be put in your cup of coffee: Milk & Sugar Order Number: 4 Amount of Order: 2.35 This is what you requested to be put in your cup of coffee: Milk & Artificial Sweetener) Press any key to continue . . .

Do you need us to help you on this or any other assignment?


Make an Order Now