All pastes #393553 Raw Edit

Someone

public javascript v1 · immutable
·published 2007-03-13 17:32 UTC
rendered paste body
//Muhammad Norat//TaskMNimport java.util.Scanner;public class TaskMN{	public static void main (String [] args)throws Exception	{		Scanner in = new Scanner (System.in);		//Initiate Variables		String name = " ";		String codeName = "BobsDiscountBolts";		int bolts = 0;		int nuts = 0;		int washers = 0;		int nameSize = 0;		int counter = 0;		int rand = 0;		double total = 0;		double vat = 0;		double grandTotal = 0;		codeName = codeName.toUpperCase();		System.out.println("********* Welcome to Bob's Discount Store ! *********");		System.out.println(" ");		System.out.print("Please enter the name of the customer : ");		name = in.nextLine();			while (!(name.equalsIgnoreCase("ZZZ")))			{			String invoice = " ";			counter ++;			System.out.println(" ");			System.out.print("How many bolts are you purchasing\t: ");			bolts = in.nextInt();			System.out.println(" ");			System.out.print("How many nuts are you purchasing\t: ");			nuts = in.nextInt();			System.out.println(" ");			System.out.print("How many washers are you purchasing\t: ");			washers = in.nextInt();			nameSize = codeName.length();			for (int x =1; x<=3; x++)				{				rand = (int)(nameSize * Math.random());				invoice = codeName.substring(rand,rand+1)+invoice;				}				double boltsPr = two.getBoltPr();			double nutsPr = two.getNutPr();			double washersPr = two.getWasherPr();			System.out.print("\n-----------------------------------------------------------------------------------------------------");			System.out.print("\n \t \t \t \t 	 Bob's Discount Store");			System.out.print("\n \t \t \t \t \t Your random code is " + invoice+counter);			System.out.print("\n ");			System.out.print("\n59 Mahatma Gandhi Street \t \t \t \t \t \t \t Telephone : 552 1234");			System.out.print("\nSTANGER \t \t \t \t \t \t \t \t \t Fax : 552 5678 ");			System.out.print("\n4450 \t \t \t \t \t \t \t \t \t email : bobs@webmail.co.za");			System.out.print("\n ");			System.out.print("\n-----------------------------------------------------------------------------------------------------");			System.out.print("\n");			System.out.print("\nNumber \t \t \t Description \t \t \t Unit Price \t \t \tTotal");			System.out.printf("\n"+bolts + "\t \t \t \t Bolts \t \t \t \t  25c \t \t \t \tR%6.2f",+bolts*boltsPr);			System.out.printf("\n"+nuts + "\t \t \t \t Nuts \t \t \t \t  15c \t \t \t \tR%6.2f",+nuts*nutsPr);			System.out.printf("\n"+washers + "\t \t \t \t Washers \t \t \t  10c \t \t \t \tR%6.2f",+washers*washersPr);			System.out.print("\n");			System.out.print("\n-----------------------------------------------------------------------------------------------------");			System.out.print("\n");			total = bolts*boltsPr+nuts*nutsPr+washers*washersPr;			vat = total*14/100;			grandTotal = vat+total;			System.out.print ("\nTotal \t \t \t \t \t \t \t \t \t \t \tR");			System.out.printf("%6.2f",total);			System.out.print("\nVat (@ 14%)\t \t \t \t \t \t \t \t \t \t \tR");			System.out.printf("%6.2f",vat);			System.out.print("\n");			System.out.print("\n-----------------------------------------------------------------------------------------------------");			System.out.print("\n");			System.out.print("Customer Name\t \t \t \t \t \t \t \t \t \t"+name);			System.out.printf("\nCustomer Owes \t \t \t \t \t \t \t \t \t \tR%6.2f",grandTotal);			System.out.print("\n");			System.out.print("\nPlease visit again . Have a nice day ");			System.out.print("\n");			if (bolts > nuts)			{			System.out.print("\n \t \t \t \t 	CHECK OUT THE ORDER ");			}else			System.out.print("\n \t \t \t \t		ORDER IS CORRECT ");			System.out.print("\n*****************************************************************************************************");			System.out.print("\nBob's Discount Store Invoice #"+counter );			System.out.print("\nProgram created by : Muhammad Norat");			Scanner input = new Scanner (System.in);			System.out.print("\nPlease enter the name of the next customer : ");			name = input.next();									}	}}