写一个程序来计算复活节星期日的日期.复活节星期日是春天第一个满月后的第一个星期天.使用数学家Carl Friedrich Gauss在1800年发明的算法:
y成为年份(如1800年或2001年)y通过19并调用剩余a.忽略商.y通过100获得商b和余数c.b通过4获得商d和余数e.8 * b + 13通过25获得商g.忽略其余部分.19 * a + b - d - g + 15通过30得到的余数h.忽略商.c通过4获得商j和余数k.a + 11 * h通过319获得商m.忽略其余部分.我试着关闭它,但我不知道把 input.close(); 放在哪里,我对这一切真的很陌生,问我的教授有失去积分的风险。此外,我不确定我是否应该保留倒数第二个 system.out 每月付款,或者摆脱它。它甚至对我的其余代码有意义吗?
import java.util.Scanner;
public class Project2 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner input = new Scanner(System.in);
//Yearly interest rate
System.out.print("Enter annual interest rate, for example 0.5, no percent sign:");
double annualInterestRate = input.nextDouble();
//Monthly interest rate
double monthlyInterestRate = annualInterestRate / 1200;
//Number of years
System.out.print("Enter number of years, for example 5: ");
int numberOfYears = input.nextInt() ;
//Loan amount
System.out.print("Enter investment amount, for example 145000.95: ");
double loanAmount …Run Code Online (Sandbox Code Playgroud)