import java.util.Scanner; public class BestBuyPay { public void display_menu() {
ID: 3824420 • Letter: I
Question
import java.util.Scanner;
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 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();
}
}
so we are doing a project in class and we need a little help since we are coming up with this
our goal is to have three option protection plans
our option want the customer to pay 10% of their overall price and that will be the cost of their protecton(to get some sort of small protection
option 2= we want the customer to pay 50% of the overall price of the item for them to have thier item fully fixed
option 3= they will pay 70%of overall price they will get a brand new item
once the costumer inputs their data we want the total to be output(the total will equal price of the item+protection+tax+
can someone gives us ideas on how we can implement this project into code (project is in java code)
Explanation / Answer
This is incomplete code and will serve no purpose as long as your question is concerned. Where is the items list and their price? Where does the customer select Item?
The flow of the program should be like this
1. Display the item details including price.
2. Read users selection.
3. Display the three protection options.
4. Read the protection option. and set the protection fee as
switch(q.nextInt())
{
case 1:
protection_fee= 0.1*price;
break;
case 2:
protection_fee= 0.5*price;
break;
case 3:
protection_fee= 0.7*price;
break;
}
5 Based on the protection option selected by user calculate the total price as
total-price= price + protection_fee+ tax;
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.