Lab 9 - Coffee Making Machine in C#

Develop a versatile coffee making machine (CMM). The CMM has a number of functionalities: setCoffeeType(String str), setGrindingTime(int secs), addCondiment(CondimentIF type), setTemperature(int degree), setLEDNumber(int num), computePrice(CoffeeIF cif), and done( ) to finish running. 

There are three built-in programs that make Regular, Mocha, and Cappuccino coffees, respectively. All programs have a run() method to control the CMM. There is also an USB port that can load in new programs to make Latte, Espresso and others. The LED can display two digits. The first digit is either 0 as idle or 1 as running. The second digit has value ranging from 0 to 3. The values 0 to 2 represent those three built-in coffee types, respectively. Digit value 3 indicates any coffee type selected from the USB. 

The machine offers a variety of condiments. The charge to each condiment is $.25 for cream, $.50 for vanilla, and $1 for chocolate. Before adding extra condiments, the menu prices are $2/cup for regular coffee, $4/cup for Mocha, $3/cup for Cappuccino, and $5/cup for the other types. All condiments can be mixed and added repeatedly as desired and the final sale price will sum up to the coffee menu price. The CMM stores their cup sale records into List<CoffeeIF>. 

 

Provide a design in UML (due in lab, 4.5 pts) and develop the system in C# (5.5 pts). 

 

The built-in Mocha will run the followings in order.

1. Indicate the machine as running and display the purchased type of coffee to LED. 

2. Grind coffee beans for 8 seconds.

3. Heat up the water to 150 degree F. 

4. Indicate the machine is idle to the LED.

 

The new Espresso program will run the followings in sequence.  

1. Indicate the machine as running and display the purchased type of coffee to LED. 

2. Grind coffee beans for 5 seconds.

3. Heat up the water to 200 degree F. 

4. Add cream and vanilla once. (Note that these condiments are included in the menu price.)

5. Indicate the machine is idle to the LED. 

 

Let different coffee types and condiments have a menu price field. However, there is no variable to store the final sale price for each cup of coffee sold. The final sale price must be computed within the coffee machine’s method computePrice(CoffeeIF cif) only. There is no other place or variable storing the sale price of a cup. For simplicity, the other methods only require a message prompt. For example, setGrindingTime(2) displays a message like “Grinding for 2 seconds.” The return types of the methods will be your own discretion. The done() method completes the transaction of a cup and adds the sold coffee object to the List. 

 

Please prepare a main program to test run your software. There will be two cups of coffee sold. Show the necessary operations of the machine and finally print out the sale price for each. 

1. A cup of Mocha with one time cream and one time vanilla added.

2. Besides the cream and vanilla, a cup of Espresso with also double chocolates added. 

Need a custom answer at your budget?

This assignment has been answered 2 times in private sessions.

© 2021 Codify Tutor. All rights reserved