Kodlar
Kodlar
seconds.
import java.util.Scanner;
Write a program that displays the sales tax with two digits after the
decimal point.
import java.util.Scanner;
// Calculate payment
double monthlyPayment = loanAmount * monthlyInterestRate / (1
- 1 / Math.pow(1 + monthlyInterestRate, numberOfYears * 12));
double totalPayment = monthlyPayment * numberOfYears * 12;
// Display results
System.out.println("The monthly payment is $" +
(int)(monthlyPayment * 100) / 100.0);
System.out.println("The total payment is $" +
(int)(totalPayment * 100) / 100.0);
}
}
This program lets the user enter the amount in decimal representing
dollars and cents and output a report listing the monetary equivalent in
single dollars, quarters, dimes, nickels, and pennies. Your program
should report maximum number of dollars, then the maximum number
of quarters, and so on, in this order
mport java.util.Scanner;
// Display results
System.out.println("Your amount " + amount + " consists of");
System.out.println(" " + numberOfOneDollars + " dollars");
System.out.println(" " + numberOfQuarters + " quarters");
System.out.println(" " + numberOfDimes + " dimes");
System.out.println(" " + numberOfNickels + " nickels");
System.out.println(" " + numberOfPennies + " pennies");
}
}