Question
Summary: A program that will calculate the cost of a gasoline/diesel powered vehicle. Description: You will be working on a comprehensive problem throughout the semester.
Summary: A program that will calculate the cost of a gasoline/diesel powered vehicle. Description: You will be working on a comprehensive problem throughout the semester. The program you will be writing will calculate the cost of a vehicle for the user and will become more complex as the semester progresses.Your solution to the problem will incorporate the Java capabilities you learn with each chapter. You are to integrate the code required as below into your Chapter 4 solution code (CPC4_S2018_your initials.java) i.e. make of duplicate of your Chapter 4 code (CPC4_S2018_your initials.java), rename it CP5_S2018_your initials.java and integrate the code required below into your submission (CPC5_S2018_your initials.java). You are to remove any Chapter 4 code that is rendered unnecessary by the requirements below: Chapter 5 Specifications: 1. Develop the methods as specific below, you will note that many of the methods below are extensions of Part 1 of the Chapter 4 specifications. N.B. the variables required are to be declared inside the respective methods. A. Method declaration: public static String inputFirstName(String messagePassed) Method description: The method is to print to the screen the value of messagePassed and return the value entered by the user. B. Method declaration: public static String inputLastName(String messagePassed) Method description: The method is to print to the screen the value of messagePassed and return the value entered by the user. C. Method declaration: public static String inputMake(String messagePassed) Method description: The method is to print to the screen the value of messagePassed and return the value entered by the user. D. Method declaration: public static String inputModel(String messagePassed) Method description: The method is to print to the screen the value of messagePassed and return the value entered by the user. E. Method declaration: public static int inputVehicleYear(String messagePassed, int lowerLimitPassed, int upperLimitPassed) Method description: Declare a variable int userInput. Use a do/while loop to print to the screen the value of messagePassed and to save the value entered by the user in userInput, you are to trap the user (repeating the request for and saving of userInput) if userInput < lowerLimitPassed or userInput > upperLimitPassed. Return userInput. F. Method declaration: public static int inputVehiclePrice(String messagePassed, double limitPassed) Method description: Declare a variable int userInput. Use a do/while loop to print to the screen the value of messagePassed and to save the value entered by the user in userInput, you are to trap the user (repeating the request for and saving of userInput) if userInput < limitPassed. Return userInput. G. Method declaration: public static double inputInterestRate(String messagePassed, double lowerLimitPassed, double upperLimitPassed, int divisorPassed) Method description: Declare a variable double userInput. Use a do/while loop to print to the screen the value of messagePassed and to save the value entered by the user in userInput, you are to trap the user (repeating the request for and saving of userInput) if userInput < lowerLimitPassed. If userInput > upperLimit divide userInput by divisorPassed and save result to userInput. Return userInput. H. Method declaration: public static double inputDownPayment(String messagePassed, double valuePassed, double limitPassed, double percentagePassed, boolean testConditionPassed) Method description: Declare a variable double userInput. Use a do/while loop to print to the screen the value of messagePassed and to save the value entered by the user in userInput, you are to trap the user (repeating the request for and saving of userInput) if userInput < limitPassed or userInput < valuePassed * percentagePassed and testConditionPassed is false. Return userInput. I. Method declaration: public static double inputMilesPerGallon(String messagePassed, double limitPassed) Method description: Declare a variable double userInput. Use a do/while loop to print to the screen the value of messagePassed and to save the value entered by the user in userInput, you are to trap the user (repeating the request for and saving of userInput) if userInput < limitPassed. Return userInput. J. Method declaration: public static double inputCostGallonFuel(String messagePassed, double limitPassed) Method description: Declare a variable double userInput. Use a do/while loop to print to the screen the value of messagePassed and to save the value entered by the user in userInput, you are to trap the user (repeating the request for and saving of userInput) if userInput < limitPassed. Return userInput. K. Method declaration: public static int inputMilesPerYear(String messagePassed, int limitPassed) Method description: Declare a variable int userInput. Use a do/while loop to print to the screen the value of messagePassed and to save the value entered by the user in userInput, you are to trap the user (repeating the request for and saving of userInput) if userInput < limitPassed. Return userInput. L. Method declaration: public static boolean inputVehicleIsNew(String messagePassed) Method description: The method is to print to the screen the value of messagePassed and return the value entered by the user. M. Method declaration: public static int inputNumberOfYearsYouHaveBeenDriving(String messagePassed, int limitPassed) Method description: Declare a variable int userInput. Use a do/while loop to print to the screen the value of messagePassed and to save the value entered by the user in userInput, you are to trap the user (repeating the request for and saving of userInput) if userInput < limitPassed. Return userInput. N. Method declaration: public static int inputNumberOfSurchargeablePoints(String messagePassed, int limitPassed) Method description: Declare a varia O. Method declaration: public static int inputNumberOfConsecutiveYearsWithZeroSurchargeablePoints(String messagePassed, int limitPassed) Method description: Declare a variable int userInput. Use a do/while loop to print to the screen the value of messagePassed and to save the value entered by the user in userInput, you are to trap the user (repeating the request for and saving of userInput) if userInput < limitPassed. Return userInput. P. Method declaration: public static char inputVehicleCode(String messagePassed) Method description: Print to the screen the value of messagePassed and save the value entered by the user in userInput. The string messagePassed should be constructed to provide to the user the information in the appropriate section of Part 1 of the Chapter 3 specifications. Return the value entered by the user. Q. Method declaration: public static String inputVehicleDescription(char codePassed) Method description: Using a switch statement (constructed using the information in the Part 2, Section R of the Chapter 3 specifications, with a controlling statement of codePassed) determine and return the string associated with codePassed. 2. Call the following methods as developed above. Pass to the methods the values noted in the Chapter 2, 3 and 4 specifications and save the values returned to the appropriate variables (as declared in the Chapter 2, 3 and 4 specifications): A. public static String inputFirstName(String messagePassed) B. public static String inputLastName(String messagePassed) C. public static int inputVehicleYear(String messagePassed, int lowerLimitPassed, int upperLimitPassed) D. public static String inputMake(String messagePassed) E. public static String inputModel(String messagePassed) F. public static double inputVehiclePrice(String messagePassed, double limitPassed) G. public static double inputInterestRate(String messagePassed, double lowerLimitPassed, double upperLimitPassed, int divisorPassed) H. public static boolean inputVehicleIsNew(String messagePassed) I. public static double inputDownPayment(String messagePassed, double valuePassed, double limitPassed, double percentagePassed, boolean testConditionPassed) J. public static double inputMilesPerGallon(String messagePassed, double limitPassed) K. public static double inputCostGallonFuel(String messagePassed, double limitPassed) L. public static int inputMilesPerYear(String messagePassed, int limitPassed) M. public static int inputNumberOfYearsYouHaveBeenDriving(String messagePassed, int limitPassed) N. public static int inputNumberOfSurchargeablePoints(String messagePassed, int limitPassed) O. public static int inputNumberOfConsecutiveYearsWithZeroSurchargeablePoints(String messagePassed, int limitPassed) P. public static char inputVehicleCode(String messagePassed) Q. public static String inputVehicleDescription(char codePassed) Chapter 5 Output: 1. Your program is to output the information to the screen as specified below. Output values will depend on input values. Print dollar signs ($) when appropriate. Print all dollar values to two decimal points. Print all decimal values to four decimal points. N.B. if the user enters invalid information the messages specified above and in prior chapter specifications will print to the screen. Please enter your first name: Mickey Please enter your last name: Mouse Please enter the year of the vehicle, must be 1886 - 2014 2013 Please enter the make of the vehicle: Porsche Please enter the model of the vehicle: Carrera Please enter the price of the vehicle, must be > : 0.00 100000 Please enter the interest rate on your loan, must be >= 0.00 and < 1.00 .07 Is the vehicle new, please enter true or false: false Please enter the down payment you will make, must be >= 0.00 and >= 20000.00 20000 Please enter the average miles per gallon, must be >= 0.00 10 Please enter the average cost of gas per gallon, must be >= 0.00 3.5 Please enter the average miles driven per year, must be >= : 0 12000 Please enter the number of years you have been driving, must be >= 0 10 Please enter your number of surchargeable points, must be >= 0 5 Please enter the number of consecutive years you have been driving in which you did not earn surchargeable points: 0 2 Please enter the vehicle code using the chart below : Code Description Weight A Passenger 1,500 - 1,999 lb B Passenger 2,000 - 2,499 lb C Passenger 2,500 - 2,999 lb D Passenger 3,000 - 3,499 lb E Passenger 3,500 lb and over F SUV na G Pickup na H Van na B Cost analysis prepared for: Mickey Mouse. The costs of buying and owning a 2013 Porsche Carrera are as follows: Purchased for $100000.00 with a downpayment of $20000.00 and an interest rate of 0.0700 on a loan of $80000.00: The monthly loan payment will be $1584.10 per month. Year 1 annual additional costs will be: Depreciation: $40000.00 Excise Tax: $2250.00 Fuel: $4200.00 Inspection Cost: $29 Insurance: $3800.00 Interest: $3009.15 Plate: $50 Registration: $50 Repair and Maintenance: $1000.00 Year 2 annual additional costs will be: Depreciation: $24000.00 Excise Tax: $1500.00 Fuel: $4200.00 Inspection Cost: $29 Insurance: $3000.00 Interest: $3009.15 Plate: $0 Registration: $0 Repair and Maintenance: $2000.00 Year 3 annual additional costs will be: Depreciation: $14400.00 Excise Tax: $1000.00 Fuel: $4200.00 Inspection Cost: $29 Insurance: $2520.00 Interest: $3009.15 Plate: $0 Registration: $50 Repair and Maintenance: $3000.00 Year 4 annual additional costs will be: Depreciation: $8640.00 Excise Tax: $625.00 Fuel: $4200.00 Inspection Cost: $29 Insurance: $2232.00 Interest: $3009.15 Plate: $0 Registration: $0 Repair and Maintenance: $4000.00 Year 5 annual additional costs will be: Depreciation: $2960.00 Excise Tax: $250.00 Fuel: $4200.00 Inspection Cost: $29 Insurance: $2059.20 Interest: $3009.15 Plate: $0 Registration: $50 Repair and Maintenance: $5000.00 The total costs will be: Total vehicle cost: $115045.75 Total depreciation cost: $90000.00 Total excise tax cost: $5625.00 Total fuel cost: $21000.00 Total inspection cost: $145 Total insurance cost: $13611.20 Total interest cost: $15045.75 Total plate cost: $50 Total registration cost: $150 Total repair and maintenance cost: $15000.00
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started