Ask DOT NET Expert

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 cream and sugar, cream and artificial sugar, milk and sugar, milk and artificial sugar at.25, .40, .30, .40 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:
You are ordering a fine cup of coffee. What 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

Please enter your selection from 1 to 5:

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.

Possible output might look like this:

You are ordering a fine cup of coffee. What 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

Please enter your selection from 1 to 5: 1

Do you want to order another cup of coffee? y

You are ordering a fine cup of coffee. What 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

Please 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. What 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

Please enter your selection from 1 to 5: 8

You entered an incorrect selection, please try again.

You are ordering a fine cup of coffee. What 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

Please 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. What 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

Please 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)

DOT NET, Programming

  • Category:- DOT NET
  • Reference No.:- M91344769
  • Price:- $40

Guranteed 36 Hours Delivery, In Price:- $40

Have any Question?


Related Questions in DOT NET

Assignment specificationthis assignment is split into two

ASSIGNMENT SPECIFICATION This assignment is split into two documents. 1. Assignment Specification. This document contains the specification for what you will be required to do. 2. Assignment Addendum. This document conta ...

Scenariouser modelling inc would like to organize a series

Scenario User Modelling Inc. would like to organize a series of conferences focusing on research topics in the area of user adaptive systems and personalization. They need to organize annual conferences for researchers a ...

Casewe sell pdfs from our site and pdfs can be ordered from

Case We sell pdf''s from our site and pdfs can be ordered from the site by selecting a book, putting it in a shopping cart, then signing in with a password or as a guest, and then checking out. For some reason, when a pu ...

Summarythis assessment requires you to develop a simple

Summary This assessment requires you to develop a simple text editor with a basic offline user login. It is a windows application that will allow new uses to be added, existing users to login, and to create/save/edit tex ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As