Write a java program on the 27 question plz answer fast
Attachments:
Answers
Answered by
1
import java.util.*;
public class Electronics
{
public void comp()
{
Scanner sc=new Scanner (System.in);
System.out.println("Menu\n L:Laptop\nD:Desktop);
System.out.println("Enter your choice");
String ch=sc.next();
System.out.println("Enter your name");
String n=sc.nextLine();
System.out.println("Enter your address");
String add=sc.nextlLine();
System.out.println("Enter amount of purchase");
double amt=sc.nextDouble();
double discount, netamt;
switch(ch)
{
case L: System.out.println("You have chosen to buy Laptop");
if(amt<=25000)
discount=0.0;
else if(amt >=25001 && amt<=57000)
discount=(5.0/100.0)*amt;
else if (amt>=57001 && amt<=100000)
discount=(7.5/100.0)* amt;
else if(amt>100000)
discount=(10.0/100)*amt;
break;
case D: System.out.println("You have chosen to buy Desktop");
if(amt<=25000)
discount=(5.0/100.0)*amt
else if(amt >=25001 && amt<=57000)
discount=(7.5/100.0)*amt;
else if (amt>=57001 && amt<=100000)
discount=(10.0/100.0)* amt;
else if(amt>100000)
discount=(15.0/100)*amt;
break;
default: System.out.println("Invalid choice");
}
net amt= amt-discount;
System.out.println("Name:" +n);
System.out.println("Address:" +add);
System.out.println("Net Amount: " +netamt);
}
}
public class Electronics
{
public void comp()
{
Scanner sc=new Scanner (System.in);
System.out.println("Menu\n L:Laptop\nD:Desktop);
System.out.println("Enter your choice");
String ch=sc.next();
System.out.println("Enter your name");
String n=sc.nextLine();
System.out.println("Enter your address");
String add=sc.nextlLine();
System.out.println("Enter amount of purchase");
double amt=sc.nextDouble();
double discount, netamt;
switch(ch)
{
case L: System.out.println("You have chosen to buy Laptop");
if(amt<=25000)
discount=0.0;
else if(amt >=25001 && amt<=57000)
discount=(5.0/100.0)*amt;
else if (amt>=57001 && amt<=100000)
discount=(7.5/100.0)* amt;
else if(amt>100000)
discount=(10.0/100)*amt;
break;
case D: System.out.println("You have chosen to buy Desktop");
if(amt<=25000)
discount=(5.0/100.0)*amt
else if(amt >=25001 && amt<=57000)
discount=(7.5/100.0)*amt;
else if (amt>=57001 && amt<=100000)
discount=(10.0/100.0)* amt;
else if(amt>100000)
discount=(15.0/100)*amt;
break;
default: System.out.println("Invalid choice");
}
net amt= amt-discount;
System.out.println("Name:" +n);
System.out.println("Address:" +add);
System.out.println("Net Amount: " +netamt);
}
}
sai311:
Thank you so much
Similar questions