尝试运行下面的程序,但在使用 switch 方法时出现错误
导入 java.util.Scanner;
/** ** @author kern 公共类贷款 {
public static void main(String[] args) {
扫描仪输入 = 新扫描仪(System.in);
//variabled decleared
double rate, payment,principal,interest,n;
int length;
String period;
//input
System.out.print("Enter the amount of money borrowed: $");
principal = input.nextDouble();
System.out.print("Enter the annual interest rate: ");
interest = input.nextDouble();
System.out.print("Enter the payment period :");
period = input.next();
System.out.print("Enter Loan Length:");
length = input.nextInt();
//process
rate=interest/100;
payment= principal*(rate*Math.pow((1+rate),n)/ Math.pow ((1+rate),n));
if (period==annually) {
n=1*length;
System.out.prtintf(Your monthly sum is %f:,payment);{
if (period==semiannuall) {
n=2*length;
System.out.prtintf(Your monthly sum is %f:,payment);{
if (period== quarterly) {
n=4*length;
System.out.prtintf(Your quarterly sum is %f:,payment);{
if (period==monthly) {
n=12*length;
System.out.prtintf(Your monthly sum is %f:,payment);{
}
}