package edu.mama.homework;
/
作业
/
public class Homework {
/
练习作业:打印从 0 ~ max 之间的所有的偶数
/
public void even(int max) {
//TODO 这里写下你的代码
}
/
练习作业:用 switch 语句代替 if
/
public void judement(char level) {
if (level == ‘A’) {
System.out.println(“你太棒啦!”);
} else if (level == ‘B’) {
System.out.println(“不错,还望再接再厉!”);
} else if (level == ‘C’) {
System.out.println(“把你家长叫来!”);
} else {
System.out.println(“你获得了再学一年称号!”);
}
//TODO 请用 switch 判断实现与以上代码相同的逻辑, 这里写下你的代码
switch(level) {
case ‘A’: System.out.println(“sw你太棒啦!”);
break;
case ‘B’: System.out.println(“sw不错,还望再接再厉!”);
break;
case ‘C’: System.out.println(“sw把你家长叫来!”);
break;
default: System.out.println(“sw你获得了再学一年称号!”);
break;
}
}
/
练习作业:输出99乘法口诀表
/
public void print() {
//TODO 这里写下你的代码
for(int i = 1; i < 10; i ++){
for(int j = i; j < 10; j++){
int a = i j;
System.out.println(i+”“+j+”=”+a);
}
}
}
public static void main(String[] args) {
//TODO 这里写下你的代码,调用上面的方法
Homework h = new Homework();
h.judement(‘A’);
h.judement(‘B’);
h.judement(‘C’);
h.judement(‘D’);
h.print();
}
}