zoukankan      html  css  js  c++  java
  • for循环实现员工投票

    public class EmployeeTest {

    public static void main(String[] args) {
    	// TODO 投票功能
    	Scanner sc = new Scanner(System.in);
    	int choice;
    	int count1 = 0,count2 = 0,count3 = 0;
    	for (int i = 0; i < 5; i++) {
    		System.out.println("***********************************");
    		System.out.println("************欢迎使用投票系统********");
    		System.out.println("***********************************");
    		System.out.println("参加评选的员工有:");
    		String[] names={"1:王小毛","2:周新雨","3:张烨"};
    		for (String string : names) {
    			System.out.println(string+"	");
    		}
    		System.out.print("请投票:");
    		choice = sc.nextInt();
    		switch (choice) {
    		case 1:
    			count1++;
    			break;
    		case 2:
    			count2++;
    			break;
    		case 3:
    			count3++;
    			break;
    		}
    		
    		System.out.println("----已有"+(i+1)+"人投票,剩余"+(5-i-1)+"票");
    	}
    	System.out.println("投票结束");
    	System.out.println("王小毛的票数是:"+count1);
    	System.out.println("周新雨的票数是:"+count2);
    	System.out.println("张烨的票数是:"+count3);
    }
    

    }

  • 相关阅读:
    23-10 条件查询
    22-9 聚合函数
    关系抽取snowball
    关系抽取bootstrap
    NER
    GPT
    因果卷积 空洞卷积
    XL-NET
    transoformer-XL
    transoformer
  • 原文地址:https://www.cnblogs.com/rainsnow/p/12188955.html
Copyright © 2011-2022 走看看