Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Complete finalCarPrice method to calculate the price of a $30K car The option is an int input argument (assume it will always be 1,

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

}

/*

Step by Step Solution

3.50 Rating (153 Votes )

There are 3 Steps involved in it

Step: 1

Solution import javautilScanner public class RentCar Predefined price variables public static final ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

An Introduction to Management Science Quantitative Approach to Decision Making

Authors: David R. Anderson, Dennis J. Sweeney, Thomas A. Williams, Jeffrey D. Camm, James J. Cochran

15th edition

978-1337406529

More Books

Students also viewed these Programming questions