Java programming on switch case
Answers
Explanation:
Computer..
hope it helps
one request pls follow me guy's
Answer:
☆♧hey there♧♤
Explanation:
import java.io.*;
import java.util.Scanner;
public class ssssss
{
public static void main(String args[])
{
Scanner ob = new Scanner(System.in);
int amt, c, dis=0, tot;
System.out.println("Enter 1 for Laptop or 2 for desktop");
c=ob.nextInt();
switch(c)
{
case 1:
System.out.println("Welcome to the LAPTOP world and Enter the amount");
amt=ob.nextInt();
if(amt<=25000)
System.out.println("No discount");
if(amt>25000&&amt<=35000)
dis=amt*2/100;
if(amt>35000&&amt<=50000)
dis=amt*5/100;
if(amt>50000)
dis=amt*8/100;
tot=amt-dis;
System.out.println("the discount is " + dis);
System.out.println("The amount you should pay " +tot);
break;
case 2:
System.out.println("Welcome to the DESKTOP world and Enter the amount");
amt=ob.nextInt();
if(amt<=15000)
System.out.println("No discount");
if(amt>15000&&amt<=25000)
dis=amt*2/100;
tot=amt-dis;
if(amt>25000&&amt<=35000)
dis=amt*5/100;
tot=amt-dis;
if(amt>35000)
dis=amt*8/100;
tot=amt-dis;
System.out.println("the discount is " + dis);
System.out.println("The amount you should pay " +tot);
break;
default :
System.out.println("Enter the number between 1 to 2");
}
}
}