我叫王超然,是一名电脑爱好者,现在在新加坡留学上高一.我立志成为一名电脑人才,愿意在这里与大家一同分享我玩转电脑的心得.O-level华文考了A-One哈哈!
天气: 晴朗
心情: 高兴
/*(Calculating interest)
If you know the balance and the annual percentage interest rate,
you can compute the interest on the next monthly payment using the
following formula:
interest = balance x (annualInterestRate / 1200)
Write a program that reads the balance and the annual percentage
interest rate and displays the interest for the next month.
*/
import java.util.Scanner;
class p1Q13
{
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);
System.out.println("Please input balance: ");
Double balance = scan.nextDouble();
System.out.println("Please input annual percentage interest rate: ");
Double annualInterestRate = scan.nextDouble();
Double interest = balance * (annualInterestRate / 1200);
System.out.println("The interest for the next month is "+interest);
}
}
导入论坛查看(31)回复(0)引用(0)好评(0) 差评(0)
加入收藏
编辑
审核
TAG:
computing