Java, first assignment on currency exchange.
发布时间
阅读量:
阅读量
题目:
(金融:货币兑换)设计一个程序,引导用户输入美元与人民币之间的汇率数值。程序应要求用户输入数字0以表示将美元转换为人民币,输入数字1以表示将人民币转换为美元。随后,程序需提示用户输入相应的货币金额,并将其换算为另一种货币形式。以下为程序运行的示例

class Tang_01_20
{
public static void main(String[] args)
{
Scanner input=new Scanner(System.in);
System.out.print("Enter the exchange rate from dollars to RMB: ");
double rate=input.nextDouble();
System.out.print("Enter 0 to convert dollars to RMB and 1 vice versa: ");
int choice=input.nextInt();
全部评论 (0)
还没有任何评论哟~
