最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

調(diào)用輸入指令Scanner

2022-06-05 21:51 作者:虛云幻仙  | 我要投稿

/**
* 根據(jù)用戶輸入月薪及一年多少薪計(jì)算年薪,按88退出計(jì)算器,按66重新計(jì)算
*/

import java.util.Scanner;
//調(diào)用Scanner 實(shí)現(xiàn)用戶輸入
public class SalaryCalculator {
? ?public static void main(String[] args) {

? ? ? ?Scanner s = new Scanner(System.in);
? ? ? ?//System.in 輸入
? ? ? ?System.out.println("年薪計(jì)算\t輸入88退出計(jì)算器\t輸入66重新計(jì)算");
? ? ? ?while (true){
? ? ? ? ? ?System.out.println("請輸入您的月薪:");
? ? ? ? ? ?int monthSalary = s.nextInt();
? ? ? ? ? ?//s.nextInt()將輸入數(shù)據(jù)轉(zhuǎn)化為int
? ? ? ? ? ?if (monthSalary == 88)break;
? ? ? ? ? ?if (monthSalary == 66)continue;
? ? ? ? ? ?System.out.println("請輸入薪數(shù):");
? ? ? ? ? ?int months = s.nextInt();
? ? ? ? ? ?if (months == 88)break;
? ? ? ? ? ?if (months == 66)continue;
? ? ? ? ? ?System.out.println("您的年薪為: "+monthSalary*months);
? ? ? ? ? ?System.out.println("感謝使用!\n輸入88退出計(jì)算器\t輸入66重新計(jì)算");

? ? ? ?}
? ? ? ?System.out.println("計(jì)算結(jié)束");
? ?}
}

調(diào)用輸入指令Scanner的評論 (共 條)

分享到微博請遵守國家法律
喀喇| 石景山区| 临湘市| 子长县| 呼伦贝尔市| 敦化市| 宜黄县| 荣昌县| 杭锦后旗| 偏关县| 陆河县| 崇仁县| 本溪| 阳江市| 伽师县| 巨鹿县| 毕节市| 贵定县| 湘乡市| 光泽县| 铁岭市| 元氏县| 新和县| 津市市| 封丘县| 平和县| 武邑县| 丁青县| 辉县市| 蓬溪县| 墨竹工卡县| 洛扎县| 门头沟区| 勃利县| 普定县| 白银市| 汽车| 崇信县| 定陶县| 瓦房店市| 鄢陵县|