All pastes #727934 Raw Edit

Someone

public text v1 · immutable
·published 2007-10-06 15:24 UTC
rendered paste body
import java.util.*;
public class Wk03Exercise3 
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		double basicSystem = 375.99;
		double thirtyEightcm = 75.99;
		double fortyThreecm = 99.99;
		double dvdCDWriter = 65.99;
		double printer = 125.00;
		double totalprice;
		
		int choiceOne;
		
		char dvdCDWriterYN;
		char printerYN;
		
		System.out.println("Please enter which size monitor you want?");
		System.out.println("Enter 1 for 38cm or 2 for 43cm ");
		choiceOne = sc.nextInt();
	
		if (choiceOne == 1)
		{
			
			System.out.println("Do you want a DVD/CD Writer? Y for Yes or N for No ");
			dvdCDWriterYN = sc.next().charAt(0);	
			
			System.out.println("Do you want a Printer? Y for Yes or N for No ");
			printerYN = sc.next().charAt(0);
			
			if (dvdCDWriterYN == 'Y' && printerYN == 'Y')
			{
				totalprice = basicSystem + thirtyEightcm + dvdCDWriter + printer;
				System.out.println("Total Price is: £" + (totalprice));
			}
			if (dvdCDWriterYN == 'Y' && printerYN == 'N')
			{
				totalprice = basicSystem + thirtyEightcm + dvdCDWriter;
				System.out.println("Total Price is: £" + (totalprice));
			}
			if (dvdCDWriterYN == 'N' && printerYN == 'Y')
			{
				totalprice = basicSystem + thirtyEightcm + printer;
				System.out.println("Total Price is: £" + (totalprice));
			}
			if (dvdCDWriterYN == 'N' && printerYN == 'N')
			{
				totalprice = basicSystem + thirtyEightcm;
				System.out.println("Total Price is: £" + (totalprice));
			}
			
					
		}
		else if (choiceOne == 2)
		{
			System.out.println("Do you want a DVD/CD Writer? Y for Yes or N for No ");
			dvdCDWriterYN = sc.next().charAt(0);	
			
			System.out.println("Do you want a Printer? Y for Yes or N for No ");
			printerYN = sc.next().charAt(0);
			
			if (dvdCDWriterYN == 'Y' && printerYN == 'Y')
			{
				totalprice = basicSystem + fortyThreecm + dvdCDWriter + printer;
				System.out.println("Total Price is: £" + (totalprice));
			}
			if (dvdCDWriterYN == 'Y' && printerYN == 'N')
			{
				totalprice = basicSystem + fortyThreecm + dvdCDWriter;
				System.out.println("Total Price is: £" + (totalprice));
			}
			if (dvdCDWriterYN == 'N' && printerYN == 'Y')
			{
				totalprice = basicSystem + fortyThreecm + printer;
				System.out.println("Total Price is: £" + (totalprice));
			}
			if (dvdCDWriterYN == 'N' && printerYN == 'N')
			{
				totalprice = basicSystem + fortyThreecm;
				System.out.println("Total Price is: £" + (totalprice));
			}	
		}

	}
}