Hi, I have a java assignment due in a couple of hours and I am stuck and i am getting a lot of errors in my code, if someone out their can help me out, i would appreciate it, thanks.
here is my java assignment.........
assign6 java.doc
this is the assignment that i am trying to finish up
hotDog.java
This is the java file I am working on!!!
Program Name: hotDog.java
Date : June 7, 2009
Author : Casey Kucera
Desc : Assignment #6
*/
import java.io.*;
public class hotDog //class name here, same as file name
{
// use BufferedReader class to input from the keyboard
// declare a variable of type BufferedReader
BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
//declare variable for input
String inputString;
String menu[] = {"Hot Dog", "Fries", "Lemonade", "End Order"};
double price[] = { 1.50, 1.00, 2.25, 0.0};
int Qty[] = new int[4];
public hotDog()throws IOException{//constructor, place class name here
welcome();
Order();
printReceipt();
}//end constructor
public void welcome(){
System.out.println("Welcome to SCC's Dog's");
}
public void Order()throws IOException {
int selection;
do
{
selection = displayMenu();
switch(selection)
{
case 1:
Qty[0] = (Qty[0] + 1);
break;
case 2:
Qty[1] = (Qty[1] + 1);
break;
case 3:
Qty[2] = (Qty[2] + 1);
break;
case 4:
System.out.print( "Ending Order");
break;
default:
System.out.println("You must choose from the menu!!!!");
}
}while(selection !=4);
}
public int displayMenu()throws IOException{
int choice;
int item = 0;
System.out.println ("(1)Hot Dog $1.50");
System.out.println ("(2)Fries $1.00");
System.out.println ("(3)Lemonade $2.25");
System.out.println ("(4)End Order");
System.out.println();
while(item < 4)
{
System.out.println("(" + (item + 1) + ") " + menu[item] + "$" + price[item]);
item ++;
}
System.out.println("(" + (item + 1) + ")" + menu[item]);
System.out.println();
System.out.print("Please make your selection from the menu: ");
choice = Integer.parseInt(input.readLine());
return choice;
}
}
public void printReceipt()throws IOException{
double total = 0;
double itemTotal = 0;
double subTotal;
double taxAmt;
int index = 0;
System.out.println("Product" + "quantity" + "price");
while (index < 3)
itemTotal = price[index] * Qty[index];
System.out.println (menu[index] + Qty[index] + itemTotal);
subTotal = subTotal + total;
index ++;
}
taxAmt = calcTax (subTotal)
total = subTotal + taxAmt;
System.out.println ("subTotal " + subTotal);
System.out.println ("Tax " + taxAmt);
System.out.println ("total " + total);
//begin calcTax
private void calcTax()throws IOException{
double tax;
doube taxRate = .07;
tax = subtotal * taxRate;
return tax;
}
public static void main(String [] args) throws IOException // main method
{
new hotDog();//class constructor name
} // end the main method
} // end the program
If someone can help me out that would be great!!!