10.20练习

(3)if的第三种结构
if (表达式一){
语句体1;
}
else if (表达式二){
语句体2;
}
else{
语句体n+1;
}

小明的奖励

Scanner sc=new Scanner(System.in);
        System.out.println("请输入你的分数:");
        int  grade=sc.nextInt();
        if (grade<=100&grade>=95) {
            System.out.println("奖励自行车");
        }
        else if(grade<=94&grade>=85) {
            System.out.println("奖励华为手机");
        }
        else System.out.println("不及格");        


打折问题
        Scanner sc=new Scanner(System.in);
        System.out.println("请输入你的VIP等级:");
        int vip=sc.nextInt();
        int price=1000;
        if (vip==1) {
        System.out.println("打一折"+(price*0.1));
        }
        else if(vip==2){
            System.out.println("打二折"+(price*0.2));
            }
        else if(vip==3) {
            System.out.println("打三折"+(price*0.3));
            }
        else System.out.println("不打折");


(1)switch语句结构
switch(表达式){
case值1;
    语句体1;
  break;
case值2;
   语句体2;
   break;
.....
default:
    语句体n+1;
       break;

流程步骤:
1.计算表达式的值
2.依次和case后面的值进行比较,如果有对应的值,就会执行相应的语句,在执行过程中,遇到break就停止
3.如果所有的case都没有对应的值,就会执行default的语句,然后结束
注意!!:1.case后面的值只能是字面量不能是变量
                  2.case给出的值不能重复。

吃面

        String noodles="兰州拉面";
        switch(noodles) {
        case "兰州拉面":
        System.out.println("吃兰州拉面");
        break;
        case "热干面":
        System.out.println("吃热干面");
        break;
        case "螺狮粉":
        System.out.println("吃螺蛳粉");
        break;
        default:
            System.out.println("吃泡面");
        
        }

运动
Scanner sc=new Scanner(System.in);
        System.out.println("请输入今天周几:");
        int week=sc.nextInt();
        switch(week) {
        case 1: 
            System.out.println("paobu");
        break;    
        case 2:
            System.out.println("youyong");
            break;
        case 3:
            System.out.println("shuijiao");
            break;
        default:
            System.out.println("xuexi");
数字

        int number=100;
        switch(number) {
        case 100:
            System.out.println("number的值为1.");
            break;
        case 2:
            System.out.println("number的值为2.");
            break;
            default:
                System.out.println("number不是1和2");
数字输出

        int number=9;
        switch (number) {
        case 1:
            System.out.println("yi");
            break;
        case 2:
            System.out.println("er");
            break;
        case 3:
            System.out.println("san");
            break;
            default:
                System.out.println("没有这种选项");
调休
Scanner sc=new Scanner(System.in);
        System.out.println("请录入一个整数表示星期:");
        int number=sc.nextInt();
        switch(number) {
        case 1:
            System.out.println("工作");
            break;
        case 2:
            System.out.println("工作");
            break;
        case 3:
            System.out.println("工作");
            break;
        case 4:
            System.out.println("工作");
            break;
        case 5:
            System.out.println("工作");
            break;
        case 6:
            System.out.println("休息");
            break;
        case 7:
            System.out.println("工作");
            break;
        default:
            System.out.println("无结果");
case穿透

    Scanner sc=new Scanner(System.in);
        System.out.println("请录入一个整数表示星期:");
        int number=sc.nextInt();
        switch(number) {
        case 1:
        case 2:
        case 3:
        case 4:
        case 5:
            System.out.println("工作");
            break;
        case 6:
        case 7:
            System.out.println("休息");
            break;
        default:
            System.out.println("无结果");
            break;
用户选择
Scanner sc=new Scanner(System.in);
        System.out.println("请输入你的号码:");
        int number=sc.nextInt();
        switch(number) {
        case 1:
            System.out.println("机票查询");
                        break;
        case 2:
            System.out.println("机票预定");
                        break;
        case 3:
            System.out.println("机票改签");
                        break;
        default:
            System.out.println("退出服务");
                                                break;    
            
        
            
循环结构

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
ContextCapture 10.20是一个软件程序,用于进行地理数据的捕捉和处理。安装ContextCapture 10.20需要按照以下步骤进行操作:首先,安装主程序。其次,在安装完成后,需要打补丁来确保软件的正常运行。最后,安装中文包以方便使用中文界面。 如果您已经完成了安装,可以在桌面上找到软件ContextCapture Center Master,并打开文件安装的位置。接下来,您需要将数据中提供的bentley.entliclib.dll文件放到该目录下,以替换原文件。 如果您还没有下载软件,请先准备好软件包数据。您可以在提供的链接中下载ContextCapture 10.20的软件包数据,并使用提取码进行解压。然后运行CCCenter-10.20.0.4117.x64-en文件来开始安装。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [【CC精品教程】ContextCapture 10.20安装教程(附CC10.20安装包下载)](https://blog.csdn.net/lucky51222/article/details/132390301)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *2* *3* [【板栗糖GIS】CC—ContextCapture10.20的安装教程](https://blog.csdn.net/weixin_46192906/article/details/127230148)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值