其他分享
首页 > 其他分享> > 2020-03-15课堂笔记

2020-03-15课堂笔记

作者:互联网

Main

package edu.xcdq;

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入你的名次");
        int count = scanner.nextInt();
        if (count == 1){
            System.out.println("去麻省理工参加夏令营");
        }
        if (count == 2){
            System.out.println("送笔记本");
        }
        if (count ==3){
            System.out.println("送硬盘一个");
        }


        switch (count){
            case  1:
                System.out.println("去麻省理工参加夏令营");
                break;
            case  2:
                System.out.println("送笔记本一个");
                break;
            case  3:
                System.out.println("送硬盘一个");
                break;
        }
    }


}

demo02

import java.util.Scanner;

/**
 * @qvthor liuwenzheng
 * @date 2021/3/15 10:16
 */
public class demo02 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入您要拨的号码");
        int num = scanner.nextInt();
        switch (num){
            case 1:
                System.out.println("拨爸爸的号码");
                break;
            case 2:
                System.out.println("拨妈妈的号码");
                break;
            case 3:
                System.out.println("拨奶奶的号码");
                break;
            case 4:
                System.out.println("拨爷爷的号码");
                break;

        }

    }
}

demo03

package edu.xcdq;

import javax.swing.plaf.synth.SynthOptionPaneUI;
import java.util.Scanner;

/**
 * @qvthor liuwenzheng
 * @date 2021/3/15 10:32
 */
//登录页面
public class demo03 {
    public static void main(String[] args) {
        System.out.println("登录菜单");
        System.out.println("1 登录系统");
        System.out.println("2 退出");
        System.out.println("请输入你要的功能");
        Scanner scanner = new Scanner(System.in);
        if (scanner.hasNextInt()){
            int bianhao = scanner.nextInt();
            if (bianhao == 1){
                System.out.println("你已进入购物系统,欢迎使用");
                System.out.println("1 客户管理系统");
                System.out.println("2 购物结算");
                System.out.println("3 真情回馈");
                System.out.println("4 注销");
                if (scanner.hasNextInt()){
                    int bianhao2 = scanner.nextInt();
                    switch (bianhao2){
                        case 1:
                            System.out.println("购物管理系统>客户信息管理");
                            System.out.println("1 显示所有客户信息");
                            System.out.println("2 添加客户信息");
                            System.out.println("3 修改客户信息");
                            System.out.println("4 查询客户信息");
                            int bainhao3 = scanner.nextInt();
                            switch (bainhao3){
                                case 1:
                                    System.out.println("zs");


                                    System.out.println("lis");


                                    System.out.println("ma5");
                                    break;

                            }
                            break;
                        case 2:
                            System.out.println("购物管理系统>购物结算");
                            System.out.println("请输入消费金额");
                            Scanner scanner1 = new Scanner(System.in);
                            double sum = scanner1.nextDouble();
                            System.out.println("是否参加优惠换购活动");
                            System.out.println("1 满50元,加2元换购百事可乐一瓶");
                            System.out.println("2 满100元,加3元换购500ml可乐一瓶");
                            System.out.println("3 满100元,加10元换购1个苏泊尔炒菜锅");
                            System.out.println("4 满200元,加20元换购欧兰雅爽肤水一瓶");
                            System.out.println("0 ,不换购。");
                            System.out.println("  请选择");
                            int funNO = scanner.nextInt();
                            switch (funNO) {
                                case 1:
                                    if (sum >= 50) {
                                        System.out.println("本次消费金额" + (sum + 2));
                                        System.out.println("成功换购百事可乐一瓶");
                                    } else
                                        System.out.println("你消费的金额不足已参加本次活动");
                                    break;
                                case 2:
                                    if (sum >= 100) {
                                        System.out.println("本次消费金额" + (sum + 3));
                                        System.out.println("成功换购500ml可乐一瓶");
                                    } else {
                                        System.out.println("你消费的金额不足已参加本次活动");
                                    }
                                    break;
                                case 3:
                                    if (sum >= 100) {
                                        System.out.println("本次消费金额" + (sum + 10));
                                        System.out.println("成功换购,苏泊尔炒菜锅");
                                    } else {
                                        System.out.println("你消费的金额不足已参加本次活动");
                                    }
                                    break;
                                case 4:
                                    if (sum >= 200) {
                                        System.out.println("本次消费金额" + (sum + 20));
                                        System.out.println("成功换购,爽肤水一瓶");
                                    }else {
                                        System.out.println("你消费的金额不足已参加本次活动");
                                    }
                                    break;
                                case 0:
                                    System.out.println("不换购");
                                    System.out.println("本次消费金额为" + sum);

                            }

                        case 3:
                            System.out.println("真情回馈");
                            System.out.println("1 幸运大放送");
                            System.out.println("2 幸运抽奖");
                            System.out.println("3 生日问候");
                            break;
                        case 4:
                            System.out.println("注销");
                            break;
                    }
                }


            }else if (bianhao == 2){
                System.out.println("你已经推出");
            }else {
                System.out.println("你输入编号不符合要求");
            }
        }else {
            System.out.println("你输入的不是整数,请重新输入");
        }
    }
}

demo04

package edu.xcdq;

import java.util.Scanner;

/**
 * @qvthor liuwenzheng
 * @date 2021/3/15 11:18
 */
public class demo04 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入消费金额:");
        System.out.println("是否参加优惠换购活动");
        System.out.println("1 是");
        System.out.println("2 否");

        int huodong = scanner.nextInt();
        if (huodong == 1) {
            System.out.println("你已参加优惠换购活动");
            System.out.println("1 满50元,加2元换购百事可乐一瓶");
            System.out.println("2 满100元,加3元换购500ml可乐一瓶");
            System.out.println("3 满100元,加10元换购1个苏泊尔炒菜锅");
            System.out.println("4 满200元,加20元换购欧兰雅爽肤水一瓶");
            System.out.println("5 ,不换购。");
            System.out.println("  请选择");
            int money  = scanner.nextInt();
                    switch (money){
                        case 1:
                            System.out.printf("money + 2");
                            break;
                        case 2:
                            System.out.printf("money+3");
                            break;
                        case 3:
                            System.out.printf("money+10");
                            break;
                        case 4:
                            System.out.printf("money+ 20");
                            break;
                    }





        }else if (huodong==3){
            System.out.printf("");
        }
    }
}

标签:case,03,15,换购,System,break,2020,println,out
来源: https://blog.csdn.net/lwz01/article/details/115479314