import java.io.*;
public class sample4 {
public static void main(String[] args)throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
double product1 = 2.98,product2=4.50,product3=9.98,product4=4.49,product5=6.87;
int hold,value;
double total;
System.out.print("Choices of Product! \n[1]Product1 \n[2]Product2 \n[3]Product3 \n[4]Product4 \n[5]Product5 \nChoose Product : ");
hold=Integer.parseInt(in.readLine());
switch(hold){
case 1:
System.out.println("Quantity you want?: ");
value = Integer.parseInt(in.readLine());
total=product1*value;
System.out.println("Product number 1:");
System.out.println("Quantity sold: "+value);
System.out.print("Amount to be paid: "+total+"$");
break;
case 2:
System.out.println("Quantity you want?: ");
value = Integer.parseInt(in.readLine());
total=product2*value;
System.out.println("Product number 2:");
System.out.println("Quantity sold: "+value);
System.out.print("Amount to be paid: "+total+"$");
break;
case 3:
System.out.println("Quantity you want?: ");
value = Integer.parseInt(in.readLine());
total=product3*value;
System.out.println("Product number 3:");
System.out.println("Quantity sold: "+value);
System.out.print("Amount to be paid: "+total+"$");
break;
case 4:
System.out.println("Quantity you want?: ");
value = Integer.parseInt(in.readLine());
total=product4*value;
System.out.println("Product number 4:");
System.out.println("Quantity sold: "+value);
System.out.print("Amount to be paid: "+total+"$");
break;
case 5:
System.out.println("Quantity you want?: ");
value = Integer.parseInt(in.readLine());
total=product5*value;
System.out.println("Product number 5:");
System.out.println("Quantity sold: "+value);
System.out.print("Amount to be paid: "+total+"$");
break; }
}
}
Walang komento:
Mag-post ng isang Komento