My code seems to work with allowing me to enter my all the data that I ask for. But the out put should something different. I am student and new at this would like some help. I made CAR LOAN CALCULATOR and it work be said this Loan Amount: $12000.0 ,Annual Interest Rate: % 5.6, Monthly Payment: $203.02, Total Payments: $14000.0 but should said Loan Amount: $12000.0, Annual Interest Rate: % 5.60, Monthly Payment: $229.77, Total Payments: $15786.09. And the in put should be Total Costs: 14000,Down Payment: 2000, Number of Years: 5, Credit Score of Applicant: 710. Please help
// Scanner input = new Scanner(System.in); public static void main(String[] args) { import java.util.Scanner; // Create a Scanner Scanner input = new Scanner(System.in); public static void main(String[] args) { // Create a Scanner Scanner input = new Scanner(System.in); // Total Cost delcaire and setup print out statements System.out.print("Enter totalCost: "); double totalCost = input.nextDouble(); // Down Payments delcaire and setup print out statements System.out.print("Enter DownPayments: "); double downPayment = input.nextDouble(); // number of Years delcaire and setup print out statements System.out.print("Enter number of Years:"); int numberOfYears = input.nextInt(); // Credit Score delcaire and setup print out statements System.out.print("Enter Credit Score of Applicant:"); double creditScore = input.nextDouble(); // other need to be delcaire double loanAmount; double monthlyPayment; int numberOfMonths = ++numberOfYears; double totalPayments; double annualInterestRatePercentage; double monthlyInterestRate; // Create the Formulas // Calculate loan Amount loanAmount = totalCost - downPayment; // Calculate Monthly Payment monthlyPayment = loanAmount / numberOfMonths; // Calculate Total Payments totalPayments = monthlyPayment * numberOfMonths + downPayment; //Calculate Annual Interest Rate Percentage annualInterestRatePercentage = 34 - creditScore/25.0; //Calculate Monthly Interest Rate with Annual Interest Rate Percentage monthlyInterestRate = annualInterestRatePercentage / 1200; //Calculate the Monthly Payment with Math.pow monthlyPayment = (loanAmount * monthlyInterestRate * Math.pow( 1 + monthlyInterestRate, numberOfMonths)) / (Math.pow(1 + monthlyInterestRate, numberOfMonths) - 1); // Display results System.out.println("Loan Amount: $" + (int) (loanAmount * 100) / 100.00); System.out.println("Annual Interest Rate: % " + (int) (annualInterestRatePercentage * 100) / 100.00); System.out.println("Monthly Payment: $" + (int) (monthlyPayment * 10) / 100.00); System.out.println("Total Payments: $" + (int) (totalPayments * 100)/ 100.00); // close the scanner input.close(); } }