All pastes #385169 Raw Edit

Unnamed

public java v1 · immutable
·published 2007-03-07 17:48 UTC
rendered paste body
//Muhammad Norat//TaskMNimport java.util.Scanner;public class print{	final static double BOLTS = 0.25;	final static double NUTS = 0.15;	final static double WASHERS = 0.10;	public static void main (String [] args)throws Exception	{		Scanner in = new Scanner (System.in);		//Initiate Variables		String name = " ";		String codeName = "Bobs Discount Bolts";		codeName = codeName.toUpperCase();  //[Cool123] I pulled this one out of the loop (Coz no use converting it each time)		int bolts = 0;		int nuts = 0;		int washers = 0;		int counter = 0;  // [Cool123] Used to keep track of the customer number		int namesize = codeName.length();  // Get the size of the name so we know it when creating random numbers		System.out.println("Please enter the name of the customer ");		name = in.next();			while (!name.equalsIgnoreCase("ZZZ"))         //[Cool123] No need for extra brackets			{			counter++;  //[Cool123] Increase the counter for the customer number			System.out.println("How many BOLTS are you purchasing ? ");			bolts = in.nextInt();			System.out.println("How many NUTS are you purchasing ? ");			nuts = in.nextInt();			System.out.println("How many WASHERS are you purchasing ? ");			nuts = in.nextInt();			System.out.println("Please enter the name of the customer ");			name = in.next();			}	}}