Complete finalCarPrice method to calculate the price of a $30K car The option is an int
Question:
Complete finalCarPrice method to calculate the price of a $30K car
The option is an int input argument (assume it will always be 1, 2, or 3):
- Option 1 is for entertainment package add-on which cost $500
- Option 2 includes option 1 and self-driving package for an additional $10K
- Option 3 includes option 2 with 3 years warrantly for an addition of $20K
Calculate the final price of the car with tax. We assume tax is another
addition of 10% of the sale price.
*/
public static double finalCarPrice(int option){
double basePrice = 30000.0; // base price of a car is $30K
double finalPrice = 0.0;
// Complete task 1 here to update the final price using if else statement
return finalPrice;
}
}
public class PSP6 {
public static void main(String[] args) {
System.out.println(finalCarPrice(1)); // should print out 33550.0
System.out.println(finalCarPrice(2)); // should print out 44550.0
System.out.println(finalCarPrice(3)); // should print out 66550.0
}
/*
An Introduction to Management Science Quantitative Approach to Decision Making
ISBN: 978-1337406529
15th edition
Authors: David R. Anderson, Dennis J. Sweeney, Thomas A. Williams, Jeffrey D. Camm, James J. Cochran