Question: i know the code is far from being complete i really need help with this any help would be greatly appreciated so im trying to
i know the code is far from being complete i really need help with this
any help would be greatly appreciated
so im trying to do a program, so what i want the program to do is
give people the option to use a protection plan- i want it to give them the choice of 3 options the first one with a 10 percent of the overall price second with 20 percent and third option with 30 percent
let say i put in the price i want like 300 dollars
then i ask the customer if she or he wants any of the protection plans
the code is in java can someone please help me
import java.util.Scanner;
import java.text.DecimalFormat;
public class BestBuyPay
{
public void display_menu()
{
System.out.println("1) Option 1 2) Option 2 3) Option 3");
System.out.print("Selection: ");
}
public void askquestion()
{
System.out.println("Would you like to continue or get no coverage plan?");
System.out.println("To proceed enter 9.");
System.out.println("If you wish to quit enter 0.");
Scanner q = new Scanner(System.in);
switch (q.nextInt())
{
case 0:
System.out.println ("Thak you for your purchase today have a nice day :).");
break;
case 9:
System.out.println ("Please continue.");
new BestBuyPay();
break;
default:
System.err.println ( "error" );
break;
}
}
public BestBuyPay()
{
Scanner in = new Scanner(System.in);
display_menu();
switch (in.nextInt())
{
case 0:
System.out.println("You selected no protection plan");
askquestion();
break;
case 1:
System.out.println ( "You Selected option 1" );
askquestion();
break;
case 2:
System.out.println ( "You Selected option 2" );
askquestion();
break;
case 3:
System.out.println ( "You Selected option 3" );
askquestion();
break;
default:
System.err.println ( "Unrecognized option" );
break;
}
}
public static void main (String[]args)
{
new BestBuyPay();
}
}
class BestBuy
{
int num(int x,double y,double t)
{
double optionone= .10;
int price;
y=.10;
double w=.20;
double n=.30;
t=.0825;
{
if (optionone=y)
{
System.out.print(price*y*t);
}
else if (optiontwo=w )
{
System.out.print(price*w*t);
}
else if (optionthree=n)
{
System.out.print(price*n*t);
};
}
}
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
