package 本章总结; public class A02class { double Money = 0; public double showA(double money, int choice) { switch (choice) { case 1: Money = (money + money * 0.0603) / 36; break; case 2: Money = (money + money * 0.0612) / 60; break; case 3: Money = (money + money * 0.0639) / 240; break; default: A02 A = new A02(); A.main(null); break; } System.out.println("月供为:"+Money); return Money; } } package 本章总结; import java.util.Scanner; public class A02 { public static void main(String[] args) { // TODO Auto-generated method stub A02class A02 = new A02class(); Scanner in = new Scanner (System.in); System.out.print("请输入贷款金额:"); double Money=in.nextDouble(); System.out.print("请选择贷款年限:1.3年(36个月) 2.5年(60个月) 3.20年(240个月):"); int choice =in.nextInt(); A02.showA(Money, choice); } }
java-第十三章-类的无参方法(一)-模拟一个简单的购房商贷月供计算器,布布扣,bubuko.com
时间: 2024-10-07 05:31:32