Hi, I'm working on a project, but I am lost in this class. I'm taking this distant ed Java class, I work 50 hours a week, and I live 2 hours from the school. Needless to say, I can never get in touch with the teacher.
Anyways, I'm trying to grasp this, but I'm having trouble. Here's the scenario:
You are planning a party and will be acting as the bartender. You need to write a program to help you mix drinks because, in spite of your excellent bartending skills, you tend to get a little confused as the night gets longer.
Your program needs to display a menu that allows you to select from at least three (3) mixed drinks. Once the drink is selected, the program will display a list of ingredients and amounts and if necessary, brief instructions. Since you need to know how much of your supply is being used, you want to keep a running total of the number of each type drink served as well as a total for overall number of drinks served
.
After displaying the drink instructions, the program should ask the user if it would like to make another drink. The user should have the option to make another drink or quit the program. In either case, the program should display the drink totals mentioned above.
Here is what I have done:
import java.util.*;
public class mixedDrinks {
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
int choice;
do
{
System.out.println("\n------- Menu----------");
System.out.println("Choose the drink you want to make: ");
System.out.println ( "1) Flying Scotsman\n2) Screwdriver\n3) Boilermaker\n0) Quit");
System.out.print ( "Selection: " );
choice = keyboard.nextInt();
switch(choice)
{
case 1:
System.out.println("Flying Scotsman:");
System.out.println ( "* 1 oz Scotch\n* 1 oz Sweet Vermouth\n* 1 dash Bitters\n* 1/4 tsp Simple Syrup\n* Ice" );
System.out.println();
System.out.println("Stir with ice and strain into a glass.");
break;
case 2:
System.out.println ( "Screwdriver:" );
System.out.println("* 1 1/2 oz Vodka\n* 5 oz Orange Juice\n* Ice");
System.out.println();
System.out.println("Pour into a glass half full of ice cubes. Stir well.");
break;
case 3:
System.out.println ( "Boilermaker:" );
System.out.println("* 1 1/2 oz. Blended Whiskey\n* 12 oz. Mug or Pilsner glass of Beer");
System.out.println();
System.out.println("Pour shot of whiskey into shot glass and drop into glass of beer. If preferred, drink whiskey straight and follow with beer chaser.");
break;
case 0:
System.out.println("Bye!");
default:
System.err.println ( "I'm sorry, please enter one of the numbers shown above." );
break;
}
}while (choice != 0);
}
}
I know this won't ask the user if they want to run it again, or keep a running total of each drink ordered. My question is, how can I make it do that? I don't know how to make it keep a total of every drink made. Then, I need to display that. Also, how can I make it end by asking the user if they want to quit? Any help would be greatly appreciated.
Thanks in advance for any help on this. :)