import java.text.DecimalFormat;
import java.util.Scanner;
public class Main
{
public static void main (String[] args)
{
String inputString; //For reading input.
String input; //Read Input
double automobileCost;
double warrantyCost;
double downPaymentAmount;
double interestRate;
double numberPayments;
double salesTaxAmount;
double totalPurchaseCost;
double amountFinanced;
double loanInterestRate;
double loanLength;
double monthlyPayment;
double annualInterestRate;
// Create a Scanner object to read input.
Scanner keyboard = new Scanner(System.in);
//Create a DecimalFormat object
DecimalFormat formatter = new DecimalFormat("#0.00");
//Get the heading of the report
System.out.println(" Deals on Wheels!");
System.out.println("Automobile Loan Schedule -- prepared for"
+ " John Smith \n ");
// Get the Automobile price.
System.out.print("Automobile price: $ ");
automobileCost = keyboard.nextDouble();
//Get the Extended warranty.
System.out.print("Extended warranty: $");
warrantyCost = keyboard.nextDouble();
//Get the Sales tax.
System.out.print("Sales tax: $");
salesTaxAmount = .0625 * automobileCost;
System.out.println(formatter.format(salesTaxAmount));
System.out.print(" ________\n ");
//Get the Total cost.
System.out.print("totalPurchaseCost: $");{
totalPurchaseCost = automobileCost + warrantyCost + salesTaxAmount;
System.out.println(formatter.format(totalPurchaseCost));
//Get the Down payment.
System.out.print("Down payment: $");
downPaymentAmount = keyboard.nextDouble();
//Get the Amount Financed
System.out.print("Amt. Financed: $");
amountFinanced = totalPurchaseCost - downPaymentAmount;
System.out.println(formatter.format(amountFinanced));
System.out.print(" ________\n ");
//Get the Annual interest rate.
System.out.println("Annual interest rate: ");
annualInterestRate = keyboard.nextDouble();
//Get the length of the loan
System.out.println("Length of loan: months");
loanLength = keyboard.nextDouble();
//Get the monthy payment.
System.out.println("Monthly Payment $");{
monthlyPayment = (amountFinanced * annualInterestRate/12) /
(1 - (Math.pow(1 + annualInterestRate/12, -loanLength )));
System.out.println(formatter.format(monthlyPayment));
}
System.exit(0);
}
}
How do I align each numbers properly and each category names properly? Please help me by showing me how to add it on my original program