I am getting and error on line 26 with Size = keyboard.nextChar ();. What am I doing wrong? Thanks for your help and time.
Code:/** * @(#)MariosPizza.java * * * @author * @version 1.00 2010/1/24 */ import java.util.Scanner; public class MariosPizza { public static void main(String args[]) { char Size; int TopComb; float Price, GST, PST, StudentDiscount, SeniorDiscount; boolean Senior, Student Scanner keyboard = new Scanner (System.in); System.out.println ("Welcome to Mario's Pizza") System.out.println ("L = Large Pizza $9.99") System.out.println ("M = Medium Pizza $7.99") System.out.println ("S = Small Pizza $5.99") System.out.println ("Please pick a basic size of pizza (S,M or L)") Size = keyboard.nextChar (); System.out.println ("You chose:" + Size) switch (Size) { case 'L': case 'l': Price = 9.99f; break; case 'M': case 'm': Price = 7.99f; break; case 'S': case 's': Price = 5.99f; break; default : System.out.println ("Not a valid choice!!"); } System.out.println ("Choose your topping combination (1 to 5)") System.out.println ("1 = Peperoni") System.out.println ("2 = Combination (Peperoni, Green Peppers and Mushrooms") System.out.println ("3 = Hawaiian (Ham and Pineapple)") System.out.println ("4 = Meat Lovers (Sausage, Peperoni and Bacon)") System.out.println ("5 = Vegetarian (Tomatoes, Olives and Green Peppers)") TopComb = keyboard.nextInt (); switch (TopComb) { case '1' : Price = Price + 1; break; case '2' : Price = Price + 3; break; case '3' : Price = Price + 2; break; case '4' : Price = Price + 3; break; case '5' : Price = Price + 3; break; default : System.out.println ("Not a valid choice!!"); } } }




Reply With Quote