Register Reciept Program
I'm having problems with writing a Register Reciept Program, the problem is with the BufferReader, giving erronious information to the screen, especially with the variable Food_price1. I going to attach the text part of the code to this thread if someone could tell me where I'm going wrong I would appreciate it.
/*
* Main.java
*
* Created on May 11, 2007, 12:12 AM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package reciept;
/**
*
* @author Frank Brenneman
*/
import java.io.*;
public class Main {
/** Creates a new instance of Main */
public Main() {
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
try
{
String Food1 = "";
String Food2 = "";
String Food3 = "";
int Food_quantity1 = 0;
int Food_quantity2 = 0;
int Food_quantity3 = 0;
int Food_price1 = 0;
int Food_price2 = 0;
int Food_price3 = 0;
int Sum = 0;
int Tax = 0;
System.out.println("Welcome to Frank's RoadKill Cafe:");
System.out.println("Enter the type of food you would like to order:");
System.out.println("For French Fries enter F,For Cheeseburger enter C,For Soda enter S:");
BufferedReader console = new BufferedReader(
new InputStreamReader(System.in));
Food1 = console.readLine();
System.out.println("Enter quantity:");
Food_quantity1 = console.read();
System.out.println("Enter Price:");
Food_price1 = console.read();
System.out.println("Enter type of food, for french fries F,for cheeseburger C,for soda S:");
Food2 = console.readLine();
System.out.println("Enter quantity:");
Food_quantity2 = console.read();
System.out.println("Enter Price:");
Food_price2 = console.read();
System.out.println("Enter type of food, for french fries F,for cheeseburger C,for soda C:");
Food3 = console.readLine();
System.out.println("Enter quantity:");
Food_quantity3 = console.read();
System.out.println("Enter Price:");
Food_price3 = console.read();
}
catch (IOException ioex)
{
System.out.println("Input error");
System.exit(1);
}
}
}

