herrDeng網內搜尋

自訂搜尋

Ads

2016年10月14日 星期五

ex8 改寫switch-case

17 則留言:

A10533005 提到...

import java.util.Scanner;

public class ex1 {

public static void main(String[] args) {
Scanner x=new Scanner(System.in);
int grade;
do{
System.out.println("請輸入成績:");
grade = x.nextInt();
if(grade<0 || grade>100) break;
int gg=grade/10;
switch(gg){
case 10: case 9: case 8:
System.out.println("甲等");
break;
case 7:
System.out.println("乙等");
break;
case 6:
System.out.println("丙等");
break;
default:
System.out.println("丁等");
}
}while(grade>=0 && grade<=100);
}

}

A10533014 提到...

import java.util.Scanner;

public class two {

public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int grade;
do {
System.out.println("輸出分數");

grade = sc.nextInt();
if (grade<0||grade>100) break;
int gg=grade/10;
switch(gg){
case 10: case 9: case 8:

System.out.println("甲等!");
break;
case 7:
System.out.println("乙等!");break;
case 6:
System.out.println("丙等!");break;
default:
System.out.println("丁等!");
break;
}
} while (grade>0 && grade<=100);



}

}

A10533003 提到...

import java.util.Scanner;

public class x2 {

public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int grade;
do {
System.out.println("輸出分數");
grade = sc.nextInt();
if(grade<0 || grade>100) break;
int gg=grade/10;
switch(gg){
case 10: case 9: case 8:
System.out.println("甲等!");break;
case 7:
System.out.println("乙等!");break;
case 6:
System.out.println("丙等!");break;
default:
System.out.println("丁等!");break;
}
} while (grade>=0 && grade<=100);
}
}

A10533004易廷軒 提到...

package hello;

import java.util.Scanner;

public class ex2 {

public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int grade;
do{
System.out.println("請輸入分數");
grade = sc.nextInt();
if(grade<0 || grade>100) break;
int gg=grade/10;
switch(gg){
case 10: case 9: case 8:
System.out.println("甲等!");
break;
case 7:
System.out.println("乙等!");
break;
case 6:
System.out.println("丙等!");
break;
default:
System.out.println("丁等!");
break;
}
}while (grade>=0 && grade<=100);


}
}

A10533012 提到...

import java.util.Scanner;
public class ex2{
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
int grade;
do {
System.out.println("請輸入分數");
grade = sc.nextInt();
if(grade<0 ||grade>100) break;
int gg=grade/10;
switch(gg)
{
case 10: case 9 : case 8:
System.out.println("甲等!");
break;
case 7:
System.out.println("乙等!");
break;
case 6:
System.out.println("丙等!");
break;
default:
System.out.println("丁等!");
}
}while (grade>=0 && grade<=100);

}
}

a10533001 提到...

import java.util.Scanner;

public class h525 {

public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int x;
do {
System.out.println("請輸入成績");
x = sc.nextInt();
if(x<0||x>100) break;
int gg=x/10;
switch(gg){
case 10:
case 9:
case 8:
System.out.println("甲等");
break;
case 7:
System.out.println("乙等");
break;
case 6:
System.out.println("丙等");
break;
default:
System.out.println("丁等");
}
} while (x>=0&&x<=100);
}

}

A10533011 提到...

import java.util.Scanner;

public class ex2 {
public static void main(String[] args) {

Scanner scan = new Scanner(System.in);
int grade;
do {
System.out.println("請輸入成績");
grade = scan.nextInt();
if (grade<0 || grade>100) break;
int a=grade/10;
switch(a){
case 10:
case 9:
case 8:
System.out.println("甲等");
break;
case 7:
System.out.println("乙等");
break;
case 6:
System.out.println("丙等");
break;
default:
System.out.println("丁等");
}
} while (grade>=0 && grade<=100);
}
}

A10533002 提到...

import java.util.Scanner;

public class ex2 {
public static void main(String[] args) {
Scanner zz = new Scanner(System.in);
int grade;
do {
System.out.println("請輸入成績");
grade = zz.nextInt();
if(grade<0 || grade>100) break;
int gg=grade/10;
switch(gg){
case 10:case 9:case 8:
System.out.println("甲等");
break;
case 7:
System.out.println("乙等");
break;
case 6:
System.out.println("丙等");
break;
default:
System.out.println("丁等");
}
} while (grade>=0 && grade<=100);

}
}

A10533006林柏宇 提到...

import java.util.Scanner;
public class hi6 {

public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int grade;
do {
System.out.println("請輸入分數:");
grade = sc.nextInt();
if(grade<0 || grade>100) break;
int gg=grade/10;
switch(gg){
case 10: case 9: case 8:
System.out.println("甲等!");
break;
case 7:
System.out.println("乙等!");
break;
case 6:
System.out.println("丙等!");
break;
default:
System.out.println("丁等!");
break;
}
}while (grade>=0 && grade<=100);

}

}

A10533009林子喬 提到...

import java.util.Scanner;
public class Holle1 {

public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int grade;
do{
System.out.println("輸出分數");
grade=sc.nextInt();
if(grade<0 || grade>100) break;
int gg=grade/10;
switch(gg){
case 10:
System.out.println("優等!");
break;
case 9: case 8:
System.out.println("甲等!");
break;
case 7: case 6:
System.out.println("乙等!");
break;
case 5: case 4:
System.out.println("丙等!");
break;
default:
System.out.println("丁等!");
break;
}
} while(grade>=0 && grade<=100);

}

A10533013 提到...

import java.util.Scanner;
public class ex2{

public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int grade;
do{
System.out.println("請輸入分數");
grade=sc.nextInt();
if(grade<0 || grade>100) break;
int gg=grade/10;
switch(gg){
case 10: case 9: case 8:
System.out.println("甲等");
break;
case 7:
System.out.println("乙等");
break;
case 6:
System.out.println("丙等");
break;
default:
System.out.println("丁等");
}
}while (grade>=0 && grade<=100);


}
}

A10533010 提到...

import java.util.Scanner;
public class ex2{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int grade;
do {
System.out.println("請輸入分數");
grade=sc.nextInt();
if(grade<0||grade>100) break;
int gg=grade/10;
switch(gg){
case 10:case 9: case 8:
System.out.println("甲等");
break;
case 7:
System.out.println("乙等");break;
case 6:
System.out.println("丙等");break;
default:
System.out.println("丁等");
}
}while (grade>=0 && grade<=100);
}
}

A10533012 提到...

import java.util.Scanner;
public class ex2{
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
int grade;
do {
System.out.println("請輸入分數");
grade = sc.nextInt();
if(grade<0 ||grade>100) break;
int gg=grade/10;
switch(gg)
{
case 10: case 9 : case 8:
System.out.println("甲等!");
break;
case 7:
System.out.println("乙等!");
break;
case 6:
System.out.println("丙等!");
break;
default:
System.out.println("丁等!");
}
}while (grade>=0 && grade<=100);

}
}

A10533010 提到...

import java.util.Scanner;
public class ex2{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int grade;
do {
System.out.println("請輸入分數");
grade=sc.nextInt();
if(grade<0||grade>100) break;
int gg=grade/10;
switch(gg){
case 10:case 9: case 8:
System.out.println("甲等");
break;
case 7:
System.out.println("乙等");break;
case 6:
System.out.println("丙等");break;
default:
System.out.println("丁等");
}
}while (grade>=0 && grade<=100);
}
}

A10533007 提到...

import java.util.Scanner;

public class will1 {

public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int grade;
do {
System.out.println("輸出分數");
grade = sc.nextInt();
if (grade<0 || grade>100) break;
int gg=grade/10;
switch(gg){
case 10: case 9: case 8:

System.out.println("甲等!");
break;
case 7:

System.out.println("乙等!");
break;
case 6:
System.out.println("丙等!");
break;
default:
System.out.println("丁等!");
break;
}
} while (grade>0 && grade<=100);



}
}

A10533016 提到...

import java.util.Scanner;

public class xfdgh {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int grade;
do {
System.out.println("請輸入分數");
grade = sc.nextInt();
if(grade<0 || grade>100) break;
int gg=grade/10;
switch(gg){
case 10: case 9: case 8:
System.out.println("甲等");
break;
case 7:
System.out.println("乙等");
break;
case 6:
System.out.println("丙等");
break;
default:
System.out.println("丁等");

}
}while (grade>=0 && grade<=100);

B10233077 提到...

import java.util.Scanner;

public class will1 {

public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int grade;
do {
System.out.println("輸出分數");
grade = sc.nextInt();
if (grade<0 || grade>100) break;
int gg=grade/10;
switch(gg){
case 10: case 9: case 8:

System.out.println("甲等!");
break;
case 7:

System.out.println("乙等!");
break;
case 6:
System.out.println("丙等!");
break;
default:
System.out.println("丁等!");
break;
}
} while (grade>0 && grade<=100);



}
}

Related Posts Plugin for WordPress, Blogger...

熱門文章