My Code:
import java.io.PrintWriter;
import java.text.DecimalFormat;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
public class Hart_PP2 {
public static void main(String[] args) {
DecimalFormat df= new DecimalFormat ("###.00");
double taxrate= .08;
Map<String,Integer> Priceproduct= new HashMap<String,Integer>();
Priceproduct.put("shoes", 50);
Priceproduct.put("shirts", 30);
Priceproduct.put("shorts", 75);
Priceproduct.put("caps", 15);
Priceproduct.put("jackets", 100);
int product= Priceproduct.get(product);
String input;
char repeat;
int option;
Scanner keyboard=new Scanner(System.in);
do
{
System.out.print("Main Menu ");
System.out.println("\n 1. Enter customer information");
System.out.println("\n 2. Price Lookup");
System.out.println("\n 3. Display Total Bill");
System.out.println("\n 4. Quit");
switch (option) {
case 1: System.out.print(" Enter the customer's name: ");
String name1=keyboard.next();
System.out.print("\n Enter the customer's address: ");
String Address=keyboard.next();
System.out.print(" Enter the customer's E-mail: ");
String Email=keyboard.next();
System.out.print("Customer has been added to the list.");
PrintWriter outputFile = new PrintWriter("CustomerData.txt");
outputFile.println(name1);
outputFile.println(Address);
outputFile.println(Email);
outputFile.close();
System.out.println("Would you like to go back to Main Menu? [Y/N]");
break;
case 2:System.out.print("Enter the product");
System.out.println(df.format (Priceproduct.get(product)));
System.out.println("Would you like to go back to Main Menu? [Y/N]");
break;
case 3:System.out.print("Enter the customer's name: ");
String name2=keyboard.next();
do
{
System.out.print( "\n Enter the product");
String product1=keyboard.nextLine();
System.out.print("\n Enter the quantity");
int quantity=keyboard.nextInt();
input=keyboard.nextLine();
repeat=input.charAt(0);
System.out.print("\n Would you like to add another product? [Y/N]");
}while(repeat=='y');
String answer = keyboard.nextLine();
while( answer.toLowerCase().equals( "y" ) );}
String answer1 = keyboard.nextLine();
while( answer1.toLowerCase().equals( "y" ) ); }
}
}
[/highlight]
It's suppose to store the products and how many you type in there (the quanitity).