Question

JAVA You have been scrimping and saving and are now looking to buy a new car....

JAVA

You have been scrimping and saving and are now looking to buy a new car.

You decided you want to buy a Honda Civic because of its good gas mileage, good trade in value and available features. Now you get to choose a package

of options.

Base price: $17,950

The car comes with these different option packages:

Option ‘P’ includes: auto transmission, power windows and locks, stereo sound system. Cost: base + 1200

Option ‘L’ includes: all of the above plus MP3 player, security alarm, cruise control. Cost: base + 1800

Option ‘D’ includes: all of the above plus deluxe detailing, pin stripes, leather seats, wind bar. Cost: base + 2500

Option ‘S’ includes: all of the above plus seat heaters, Bose speakers, OnStar, steering wheel control of music system, chrome rims. Cost: base + 3100

You want to know how much you can borrow and what the monthly payment would be.

Ask the user to enter the

 options package (if any)

 down payment amount

 annual interest rate of loan (as a percent ie: user enters 5 for 5% (which is .05)

 length of loan in years

 annual income

This is the formula to compute the monthly payment:

MP = P * (J/(1 – ((1 + J) -N) ) ) //1 this is a one not an i

 MP = monthly payment (this is the amount you will calculate)

P = principal, the amount of the loan (car price – down payment)

 I = the annual interest rate (from 1 to 100 percent like 3.8 or 5.5)

L = length, the length (in years) of the loan, or at least the length over which the loan is amortized. (like 5.2 years, 3.5 years…)

The following assumes a typical conventional loan where the interest is compounded monthly. First I will define two more variables to make the calculations easier:

J = monthly interest in decimal form = I / (12 x 100)

N = number of months over which loan is amortized = L x 12

You will need to use the built in pow( ) function for the exponent.

This is how to use the pow( ) function.

answer = Math.pow(2,3); //will result in answer being 23, which is 8

You are eligible for the loan if your monthly income is at least four times the monthly car payment.

Write a program that first presents the user with a list of package options: ‘P’, ‘L’, ‘D’ or ‘S’.

Make this presentation of options visually pleasing. The user may enter ‘B’ for just the basic car, with no options.

From the choice of the options package determine the cost of the car.

Then prompt the user to enter their down payment amount, life of loan, annual interest rate and annual income.

From all the data collected from the user, determine the monthly payment and determine if the user is eligible for the loan. The user is eligible if his/her monthly income is at least four times greater

than or equal to the monthly payment.

Your output should print the price of the car, the down payment amount, the loan amount, the monthly payment and a message stating whether the user is eligible to take the loan or not.

All documentation standards apply.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Code

import java.text.NumberFormat;
import java.util.Locale;
import java.util.Scanner;
public class Main
{
public static void main(String[] args)
{
Scanner sc =new Scanner(System.in);
String choice;
double basePrice=17950.00;
double finalPrice=0,downPayment,I,annualIncome,MP;
int L;
NumberFormat us = NumberFormat.getCurrencyInstance(Locale.US);
System.out.println("Option ‘P’ includes: auto transmission, power windows and locks, stereo sound system. Cost: base + 1200");
System.out.println("Option ‘L’ includes: all of the above plus MP3 player, security alarm, cruise control. Cost: base + 1800");
System.out.println("Option ‘D’ includes: all of the above plus deluxe detailing, pin stripes, leather seats, wind bar. Cost: base + 2500");
System.out.println("Option ‘S’ includes: all of the above plus seat heaters, Bose speakers, OnStar, steering wheel control of music system, chrome rims. Cost: base + 3100");
System.out.println("‘B’ for just the Basic model.");
System.out.print("\n\nEnter you option : ");
choice=sc.next();
if(choice.equalsIgnoreCase("p"))
finalPrice=basePrice+1200;
else if(choice.equalsIgnoreCase("l"))
finalPrice=basePrice+1800;
else if(choice.equalsIgnoreCase("d"))
finalPrice=basePrice+2500;
else if(choice.equalsIgnoreCase("s"))
finalPrice=basePrice+3100;
else if(choice.equalsIgnoreCase("b"))
finalPrice=basePrice;
System.out.print("Please enter the down payment : ");
downPayment=sc.nextDouble();
System.out.print("Please enter length of loan in years: ");
L =sc.nextInt();
System.out.print("Please enter intrest rate: ");
I=sc.nextDouble();
System.out.print("Please the annual income : ");
annualIncome=sc.nextDouble();
  
double P=finalPrice-downPayment;
double J=I/(12*100);
int N=L*12;
  
MP=(P*J) / (1-Math.pow(1+J, -N));
  
double monthlyIncome=annualIncome/12;
System.out.println("\nCar price: "+us.format(finalPrice));
System.out.println("Down payment amount: "+us.format(downPayment));
System.out.println("Loan amount: "+us.format(P));
System.out.println("Monthly Payment : "+us.format(MP));
if(4*MP<monthlyIncome)
System.out.println("Eligible for loan");
else
System.out.println("Not Eligible for loan");
}
}

output

If you have any query regarding the code please ask me in the comment i am here for help you. Please do not direct thumbs down just ask if you have any query. And if you like my work then please appreciates with up vote. Thank You.

Add a comment
Know the answer?
Add Answer to:
JAVA You have been scrimping and saving and are now looking to buy a new car....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • You are looking to buy a car. You can afford $520 in monthly payments for four...

    You are looking to buy a car. You can afford $520 in monthly payments for four years. In addition to the loan, you can make a $1,700 down payment. If interest rates are 8.75 percent APR, what price of car can you afford (loan plus down payment)?

  • You are considering buying a car with an amortized loan. The car loan will be $40,000...

    You are considering buying a car with an amortized loan. The car loan will be $40,000 and have an annual interest rate of 2.8%, compounded monthly. You have two options for financing the car, the first is a fully amortized loan for 72 months while the second is a partially amortized loan for 36 months with a balloon payment of $18,000 (i.e. you will still owe $18,000 on the loan at month 36). What are the payments for each option?

  • You are looking to buy a car. You can afford $730 in monthly payments for five...

    You are looking to buy a car. You can afford $730 in monthly payments for five years. In addition to the loan, you can make a $830 down payment. If interest rates are 10.00 percent APR, what price of car can you afford (loan plus down payment)? (Do not round Intermediate calculations and round your final answer to 2 decimal places.) Present value To borrow $3,700, you are offered an add-on interest loan at 9.3 percent with 12 monthly payments....

  • You are looking to buy a car. You can afford $550 in monthly payments for four...

    You are looking to buy a car. You can afford $550 in monthly payments for four years. In addition to the loan, you can make a $2,000 down payment. If interest rates are 9.50 percent APR, what price of car can you afford (loan plus down payment)? (Do not round Intermediate calculations and round your final answer to 2 decimal places.) Present value

  • You want to buy a car that will cost $33,100. You have $2,750 cash as a...

    You want to buy a car that will cost $33,100. You have $2,750 cash as a down payment. You will finance the remainder of the cost through a loan that will require equal monthly payments of principal and 6.75% APR interest over five years Compute the amount of the monthly loan payment that you will need to make. Rate Nper PMT PV FV туре Prepare a loan amortization schedule using the format presented below. Use the amortization schedule to answer...

  • You want to buy a car that will cost $33, 100. You have $2,750 cash as...

    You want to buy a car that will cost $33, 100. You have $2,750 cash as a down payment. You will finance the remainder of the cost through a loan that will require equal monthly payments of principal and 6.75% APR interest over five years. Compute the amount of the monthly loan payment that you will need to make. Rate 6.75% Nper PMT PV FV Type Prepare a loan amortization schedule using the format presented below. Use the amortization schedule...

  • Problem 5-25 Present Value (LG5-4) You are looking to buy a car. You can afford $390...

    Problem 5-25 Present Value (LG5-4) You are looking to buy a car. You can afford $390 in monthly payments for four years. In addition to the loan, you can make a $1,600 down payment. If interest rates are 8.50 percent APR, what price of car can you afford (loan plus down payment)? (Do not round intermediate calculations and round your final answer to 2 decimal places.) Present value

  • You have been dreaming of owning a home, and are excited to have found a well-maintained...

    You have been dreaming of owning a home, and are excited to have found a well-maintained 3 bedroom house on a lake for $338,000. You have been pre-approved for a 30-year fixed rate mortgage at 4.5% annual interest with a 20% down payment and $2,500 due at closing, but did not spend much time shopping around for a lender. Your friend, who works for Waterstone Mortgage tells you two of their current options. The first option from Waterstone is a...

  • Exercise 1 - Time value of money: You want to buy a brand new Tesla Model S car. The dealer offer...

    Exercise 1 - Time value of money: You want to buy a brand new Tesla Model S car. The dealer offers you 3 payment options: (1) Make monthly payments of S2,325 over a period of 3 years at the end of every month. (2) Pay $10,000 upfront, and $65,000 3 years from now. Mabe 1 qal pmecet 33 Annual interest rate is 12%. Required: 1. Calculate the present value of option (1) 2. Calculate the present value of option (2)...

  • 5.08 You want to buy a car, and a local bank will lend you $30,000. The...

    5.08 You want to buy a car, and a local bank will lend you $30,000. The loan will be fully amortized over 5 years (60 months), and the nominal interest rate will be 10% with interest paid monthly. What will be the monthly loan payment? What will be the loan's EAR? Do not round intermediate calculations. Round your answer for the monthly loan payment to the nearest cent and for EAR to two decimal places. Monthly loan payment: $   EAR:   %

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT