Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I have a mini computer science project that I am working on and it\'s kind of co

ID: 3574630 • Letter: I

Question

I have a mini computer science project that I am working on and it's kind of confusing. What classes should I have and what methods? It also asks to use arrays and I dont know how it fits in this situation. Here's the question:

You are hired to develop a program for a client who described what he wants using the following scenario:

“I like to drink a beverage every morning. This might be a cup of coffee or tea. If it is coffee, I like to choose (based on wake up time) b/w espresso (short or long) or latte with one or two shots of espresso, no foam, and extra hot. If it is tea, I like to have either green or black tea; the latter can be with lemon or with half and half and sugar, depending of the kind of tea. I have a large collection of coffee and tea capsules and my beverage machine could be programmed (in Java) to make a drink at the specified time.

- I would like to have a program which will allow me to set up at evening my coming morning drink. Sometimes, I order my beverage from my neighborhood coffee shop specifying a pick up time .”

You manager and you agreed on the following specs on what the solution will look like:

Design specs

Interactive: ask for options using UI (keyboard /Scanner or speech recognition =) ) and print out (screen) the choice

Store data in files (read from; write to .... )

Modular: use several classes and various method

Use test cases (aka have a driver / main)

Implementation specs

Define preconditions and postconditions
Handle exceptions
Use default values for your variables
Use arrays (many kinds of coffee, tea, milk, ...) for your data Comment and Document

Explanation / Answer

PreConditions:

Coffee has to be chosen b/w espresso or latte with one or two shots of espresso. Tea can be either green or black tea.

Arrays for Tea, Coffee, Milk should contain the respective quantity available in the machine.

The first class to be created is Beverage. Let this class have two member variables - coffee and tea. Create another class which will have "methods" to prepare coffee or Tea based on user selection in UI.

Provide a UI with 2 options - either Coffee OR Tea.

So when the user selects a option, based on pre - conditions display the option as:

1. For coffee - Espresso (short or long) OR Latte with one or two shots of espresso, no foam, and extra hot.

2. For Tea - either Green or Black tea with lemon or with half and half and sugar.

When the user selects the option, prepare the beverage accordingly.

By default, prepare a Coffee with Espresso when user does not select anything.

And if the user selects Coffee and nothing more, prepare Espresso. If the user selects Tea and nothing more, prepare Black Tea. You can have this configured in methods to prepare coffee or tea in the second class said above.