Question: / / statement used to create a keyboard input connection import java.until.Scanner; public class Program 1 { / / Main Function public static void main
statement used to create a keyboard input connection
import java.until.Scanner;
public class Program
Main Function
public static void mainString args
statement used to create a keyboard input connection
Scanner in new ScannerSystemin;
Prompt the user to input the price that they're willing to pay for their dream car in USD$
System.out.printHow much are you willing to pay for the car of your dreams in USD$;
User input for the price they're willing to pay for their dream car
double price stdIn.nextDouble;
Initialize discountRate variable and final price variable
double discountRate finalPrice ;
Determine the discountRate based on the price using if else if method
first statement compares user's inputted price to If it meets the criteria,then the corrisponding discount is used.
if price
discountRate ;
if the price does not meet the conditions of the if statement then price will be compared to the else if statement.
else if price
discountRate ;
if the price does not meet the criteria of the if statement or the else if statements above, then the price will be compared to the else statement. If the price does not meet the criteria of the if statement,else if statement,or else statement then no discount will be applied.
else
discountRate ;
Calculate the discountRate and final price
finalPrice pricepricediscountRate;
Display the result. The result includes the final output statement with calculated discountRate percentage and final price of user's dream car
System.out.printfWow with your dicount of applied, you only owe Congrats!";
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
