【发布时间】:2019-11-27 20:39:44
【问题描述】:
我正在为一项任务编写一个程序。 在那里,我陷入了如何为我的程序添加天和月的问题。
我已经可以将简单的兴趣转换为年,但不能转换为几个月和几天:
import java.util.Scanner;
public class SimpleInterest {
public static void main(String[] args) {
double PAmount, ROI, TimePeriod, simpleInterset;
Scanner scanner = new Scanner(System.in);
System.out.print(" Please Enter the Principal Amount : ");
PAmount = scanner.nextDouble();
System.out.print(" Please Enter the Rate Of Interest : ");
ROI = scanner.nextDouble();
System.out.print(" Please Enter the Time Period in Years : ");
TimePeriod = scanner.nextDouble();
simpleInterset = (PAmount * ROI * TimePeriod) / 100;
System.out.println("\n The Simple Interest for Principal Amount " + PAmount + " is = " +
simpleInterset);
}
}
【问题讨论】:
-
你试过什么?你有没有为此制定一个总体计划?
-
days 和 months 的用途是什么?如果它们要受到nominal interest rate 的每日或每月计算,您是否需要数学公式,还是您的问题是将公式带入代码?
-
我应该编写一个简单的兴趣程序,显示作业的年日和月,没有提到在代码中使用公式
-
嘿!这是您还是您的一位同事在问类似的问题:stackoverflow.com/questions/59079261/…?
标签: java finance calculation