herrDeng網內搜尋

自訂搜尋

Ads

2014年3月25日 星期二

Java作業7 switch case改寫成if-else if


37 則留言:

B10233089 提到...

import java.util.*;
public class hello {
private static Scanner input;
public static void main(String[] args) {
Random rnd=new Random();
int z=rnd.nextInt(5);
int x=99;
while(x!=z){
System.out.println("輸入數字:(0-4)");
input=new Scanner(System.in);
x=input.nextInt();
if (x==1)
System.out.println("ONE");
else if (x==2)
System.out.println("TWO");
else if (x==3)
System.out.println("THREE");
else
System.out.println("其他");
}
System.out.println("z="+z);
}
}

B10233069連于傑 提到...

package ex325;
import java.util.*;
public class hello325 {
private static Scanner input;

public static void main(String[] args){
Random rnd=new Random();
int z=rnd.nextInt(5);
int x=99;
while (x!=z){
System.out.println("輸入數字:(0-4)");
input = new Scanner(System.in);
x=input.nextInt();
if (x==1)
System.out.println("ONE");
else if(x==2)
System.out.println("TWO");
else if(x==3)
System.out.println("THREE");
else
System.out.println("其他");
}
System.out.println("z="+z);
}

}

B10233067 提到...

import java.util.*;
public class hello {
private static Scanner input;
public static void main(String[] args) {
Random rnd=new Random();
int z=rnd.nextInt(5);
int x=99;
while(x!=z){
System.out.println("輸入數字:(0-4)");
input=new Scanner(System.in);
x=input.nextInt();
if (x==1)
System.out.println("ONE");
else if (x==2)
System.out.println("TWO");
else if (x==3)
System.out.println("THREE");
else
System.out.println("其他");
}
System.out.println("z="+z);
}
}

B10233103 提到...

package hhhh;

import java.util.*;

public class hhh {
private static Scanner input;
public static void main(String[] args) {
Random rnd=new Random();
int z=rnd.nextInt(5);
int x=99;
while(x!=z){
System.out.println("輸入數字:(0-4)");
input = new Scanner(System.in);
x=input.nextInt();
if (x==1)
System.out.println("one");
else if(x==2)
System.out.println("two");
else if(x==3)
System.out.println("three");
else
System.out.println("其他");
}
System.out.println("z="+z);
}

}

B10233109 提到...

package k;

import java.util.*;
public class yuh {
private static Scanner input;
public static void main(String[] args) {
Random rnd=new Random();
int z=rnd.nextInt(5);
int x=99;
while(x!=z) {
System.out.println("輸入數字:(0-4)");
input = new Scanner(System.in);
x= input.nextInt();
if (x==1)
System.out.println("ONE");
else if(x==2)
System.out.println("TWO");
else if(x==3)
System.out.println("THREE");
else
System.out.println("其他");
}
System.out.println("z="+z);

}

}

B10233064 莊英霆 提到...

import java.util.*;
public class Game {
private static Scanner input;
public static void main(String[] args) {
Random rnd=new Random();
int z=rnd.nextInt(10);
int x=88;
while(x!=z) {
System.out.println("請輸入數字0-10");
input= new Scanner(System.in);
x=input.nextInt();
if (x==1)
System.out.println("One");
else if (x==2)
System.out.println("Two");
else if (x==3)
System.out.println("Three");
else
System.out.println("其他");
}
System.out.println("z="+z);
}
}

B10233061 吳興強 提到...

package hello;
import java.util.*;
public class hello {
private static Scanner input;
public static void main(String[] args) {
Random rnd=new Random();
int z=rnd.nextInt(9);
int x=99;
while(x!=z){
System.out.println("輸入數字:(0-8)");
input = new Scanner(System.in);
x=input.nextInt();

if (x==1)
System.out.println("ONE");

else if (x==2)
System.out.println("TWO");

else if (x==3)
System.out.println("THREE");

else
System.out.println("其他");
}
System.out.println("z="+z);

}
}

B10233064 莊英霆 提到...

import java.util.*;
public class Game {
private static Scanner input;
public static void main(String[] args) {
Random rnd=new Random();
int z=rnd.nextInt(10);
int x=88;
while(x!=z) {
System.out.println("請輸入數字0-10");
input= new Scanner(System.in);
x=input.nextInt();
if (x==1)
System.out.println("One");
else if (x==2)
System.out.println("Two");
else if (x==3)
System.out.println("Three");
else
System.out.println("其他");
}
System.out.println("z="+z);
}
}

B10233098 陳孟緣 提到...

package hhhh;

import java.util.*;

public class hhh {
private static Scanner input;
public static void main(String[] args) {
Random rnd=new Random();
int z=rnd.nextInt(5);
int x=99;
while(x!=z){
System.out.println("輸入數字:(0-4)");
input = new Scanner(System.in);
x=input.nextInt();
if (x==1)
System.out.println("one");
else if(x==2)
System.out.println("two");
else if(x==3)
System.out.println("three");
else
System.out.println("其他");
}
System.out.println("z="+z);
}

}

B10233097 邱宥甄 提到...

package hhhh;

import java.util.*;

public class hhh {
private static Scanner input;
public static void main(String[] args) {
Random rnd=new Random();
int z=rnd.nextInt(5);
int x=99;
while(x!=z){
System.out.println("輸入數字:(0-4)");
input = new Scanner(System.in);
x=input.nextInt();
if (x==1)
System.out.println("one");
else if(x==2)
System.out.println("two");
else if(x==3)
System.out.println("three");
else
System.out.println("其他");
}
System.out.println("z="+z);
}

}

B10233096 提到...

package hhhh;

import java.util.*;

public class hhh {
private static Scanner input;
public static void main(String[] args) {
Random rnd=new Random();
int z=rnd.nextInt(5);
int x=99;
while(x!=z){
System.out.println("輸入數字:(0-4)");
input = new Scanner(System.in);
x=input.nextInt();
if (x==1)
System.out.println("one");
else if(x==2)
System.out.println("two");
else if(x==3)
System.out.println("three");
else
System.out.println("其他");
}
System.out.println("z="+z);
}

}

B10233080陳芊慈 提到...

package hhhh;

import java.util.*;

public class hhh {
private static Scanner input;
public static void main(String[] args) {
Random rnd=new Random();
int z=rnd.nextInt(5);
int x=99;
while(x!=z){
System.out.println("輸入數字:(0-4)");
input = new Scanner(System.in);
x=input.nextInt();
if (x==1)
System.out.println("one");
else if(x==2)
System.out.println("two");
else if(x==3)
System.out.println("three");
else
System.out.println("其他");
}
System.out.println("z="+z);
}

}

B10233066張哲毓 提到...

package gu;

import java.util.*;

public class jnhn {
private static Scanner input;
public static void main(String[] args) {
Random rnd=new Random();
int z=rnd.nextInt(5);
int x=99;
while(x!=z) {
System.out.println("輸入數字:(0-4)");
input = new Scanner(System.in);
x= input.nextInt();
if (x==1)
System.out.println("ONE");
else if (x==2)
System.out.println("TWO");
else if (x==3)
System.out.println("THREE");
else
System.out.println("其他");
}
System.out.println("z="+z);
}
}

B10233091許少威 提到...

package hello0325;
import java.util.*;
public class hello {
private static Scanner input;
public static void main(String[] args) {
Random rnd=new Random();
int z=rnd.nextInt(5);
int x=99;
while (x!=z) {
System.out.println("輸入數字:(0-4)");
input = new Scanner(System.in);
x = input.nextInt();
if (x==1)
System.out.println("ONE");
else if(x==2)
System.out.println("TWO");
else if (x==3)
System.out.println("THREE");
else
System.out.println("其他");
}
System.out.println("z="+z);
}

}

B10233081藍立凱 提到...

package hello0326;
import java.util.*;
public class hello {
private static Scanner input;
public static void main(String[] args) {
Random rnd=new Random();
int z=rnd.nextInt(5);
int x=99;
while (x!=z){
System.out.println("輸入數字:(0-4)");
input = new Scanner(System.in);
x=input.nextInt();
if (x==1)
System.out.println("ONE");
else if(x==2)
System.out.println("TWO");
else if(x==3)
System.out.println("THREE");
else
System.out.println("其他");
}
System.out.println("z="+z);
}
}

B10233106 葉作暐 提到...

package gu;

import java.util.*;
public class hell {
private static Scanner input;
public static void main(String[] args) {
Random rnd=new Random();
int z=rnd.nextInt(5);
int x=99;
while(x!=z) {
System.out.println("輸入數字:(0-4)");
input = new Scanner(System.in);
x= input.nextInt();
if (x==1)
System.out.println("ONE");
else if(x==2)
System.out.println("TWO");
else if(x==3)
System.out.println("THREE");
else
System.out.println("其他");
}
System.out.print("z="+z);
}

}

B10233092 提到...

package asd;

import java.util.*;

public class qwe {
private static final String X = null;
private static Scanner input;
public static void main(String[] args) {
Random rnd=new Random();
Scanner sc=new Scanner(System.in);
System.out.println("輸入數字:(0-4)");
int X=99;
int z=rnd.nextInt(5);
while(X!=z){
input = new Scanner(System.in);
X=sc.nextInt();
if(X ==1) {
System.out.println("ONE");
}
else if(X == 2) {
System.out.println("TWO");
}
else if(X == 3) {
System.out.println("THREE");
}
else{
System.out.println("其他");
}
}
System.out.println("z="+z);
}
}

B10233090 提到...

package yy;
import java.util.*;
public class fhh {
private static Scanner input;
public static void main(String[] args) {
Random rnd=new Random();
int z=rnd.nextInt(5);
int x=99;
while(x!=z) {
System.out.println("輸入數字(0-4)");
input = new Scanner(System.in);
x=input.nextInt();
System.out.println(x);

if (x==1)
System.out.println("one");

else if (x==2)
System.out.println("two");

else if (x==3)
System.out.println("three");

else
System.out.println("其他");

}
System.out.println("z="+z);
}

}

b10233075謝如華 提到...

package hello0325;
import java.util.*;
public class hello {
private static Scanner input;
public static void main(String[] args) {
Random rnd=new Random();
int z=rnd.nextInt(5);
int x=99;
while (x!=z) {
System.out.println("輸入數字:(0-4)");
input = new Scanner(System.in);
x = input.nextInt();
if (x==1)
System.out.println("ONE");
else if(x==2)
System.out.println("TWO");
else if (x==3)
System.out.println("THREE");
else
System.out.println("其他");
}
System.out.println("z="+z);
}

}

B10233063 張宜禎 提到...

package hello0325;
import java.util.*;
public class hello0325 {
private static Scanner input;
public static void main(String[] args) {
Random rnd=new Random();
int z=rnd.nextInt(5);
int x=99;
while (x!=z) {
System.out.println("輸入數字:(0-4)");
input = new Scanner(System.in);
x = input.nextInt();
if (x==1)
System.out.println("ONE");
else if(x==2)
System.out.println("TWO");
else if (x==3)
System.out.println("THREE");
else
System.out.println("其他");
}
System.out.println("z="+z);
}

}

B10233084 陳億如 提到...

package hello3225;
import java.util.*;
public class hello0325 {
private static Scanner input;
public static void main(String[] args) {
Random rnd=new Random();
int z=rnd.nextInt(5);
int x=99;
while (x!=z) {
System.out.println("輸入數字:(0-4)");
input = new Scanner(System.in);
x = input.nextInt();
if (x==1)
System.out.println("ONE");
else if(x==2)
System.out.println("TWO");
else if (x==3)
System.out.println("THREE");
else
System.out.println("其他");
}
System.out.println("z="+z);
}

}

B10233079 提到...

package yy;
import java.util.*;
public class fhh {
private static Scanner input;
public static void main(String[] args) {
Random rnd=new Random();
int z=rnd.nextInt(5);
int x=99;
while(x!=z) {
System.out.println("輸入數字(0-4)");
input = new Scanner(System.in);
x=input.nextInt();
System.out.println(x);

if (x==1)
System.out.println("one");

else if (x==2)
System.out.println("two");

else if (x==3)
System.out.println("three");

else
System.out.println("其他");

}
System.out.println("z="+z);
}

}

B10233079 提到...

package yy;
import java.util.*;
public class fhh {
private static Scanner input;
public static void main(String[] args) {
Random rnd=new Random();
int z=rnd.nextInt(5);
int x=99;
while(x!=z) {
System.out.println("輸入數字(0-4)");
input = new Scanner(System.in);
x=input.nextInt();
System.out.println(x);

if (x==1)
System.out.println("one");

else if (x==2)
System.out.println("two");

else if (x==3)
System.out.println("three");

else
System.out.println("其他");

}
System.out.println("z="+z);
}

}

B10233102 提到...

package yy;
import java.util.*;
public class fhh {
private static Scanner input;
public static void main(String[] args) {
Random rnd=new Random();
int z=rnd.nextInt(5);
int x=99;
while(x!=z) {
System.out.println("輸入數字(0-4)");
input = new Scanner(System.in);
x=input.nextInt();
System.out.println(x);

if (x==1)
System.out.println("one");

else if (x==2)
System.out.println("two");

else if (x==3)
System.out.println("three");

else
System.out.println("其他");

}
System.out.println("z="+z);
}

}

B10233062 黃聖評 提到...

package sha;

import java.util.*;

public class sha1 {
private static Scanner input;
public static void main(String[] args) {
Random rnd=new Random();
int z=rnd.nextInt(5);
int x=99;
while(x!=z){
System.out.println("輸入數字(0-4)");
input = new Scanner(System.in);
x=input.nextInt();
System.out.println(x);
if(x==1)
System.out.println("ONE");
else if(x==2)
System.out.println("TWO");
else if(x==3)
System.out.println("THREE");
else
System.out.println("其他");

}
System.out.println("z="+z);
}

B10233108 林宣瑋 提到...

import java.util.*;
public class LaoLin0325 {
private static Scanner input;
public static void main(String[] args) {
Random rnd=new Random();
int z=rnd.nextInt(5);
int x=99;
while (x!=z) {
System.out.println("請輸入數字:(0-4)");
input =new Scanner(System.in);
x= input.nextInt();
if(x==1)
System.out.println("ONE");
else if(x==2)
System.out.println("TWO");
else if(x==3)
System.out.println("THREE");
else
System.out.println("其他");

}
System.out.println("z="+z);
}
}

Y10211027 提到...

package helen0325;

import java.util.*;

public class test0325 {
private static Scanner input;
public static void main(String[] args) {
Random rnd=new Random();
int z=rnd.nextInt(5);
int x=99;
while(x!=z) {
System.out.println("輸入數字:(0-15)");
input = new Scanner(System.in);
x= input.nextInt();
if(x==1)
System.out.println("ONE");
else if(x==2)
System.out.println("TWO");
else if(x==3)
System.out.println("THREE");
else
System.out.println("其他");
}

System.out.println("z="+z);
}

}

B10233076 提到...

package hello;
import java.util.*;
public class hello {
private static Scanner input;
public static void main(String[] args) {
Random rnd= new Random();
int z=rnd.nextInt();
int x=99;
while(x!=z){
System.out.println("輸入數字:(0-4)");
input=new Scanner(System.in);
x=input.nextInt();
if(x==1)
System.out.println("ONE");
else if(x==2)
System.out.println("TWO");
else if(x==3)
System.out.println("THREE");
else
System.out.println("其他");
}
System.out.println("z="+z);
}

}

b10233068邱佳函 提到...

package hello0325;
import java.util.*;
public class hello {
private static Scanner input;

public static void main(String[] args) {
Random rnd=new Random();
int z=rnd.nextInt(5);
int x=99;
while (x!=z){
System.out.println("輸入數字:(0-4)");
input = new Scanner(System.in);
x= input.nextInt();
if(x==1)
System.out.println("ONE");
else if(x==2)
System.out.println("TWO");
else if(x==3)
System.out.println("THREE");
else
System.out.println("其他");
}
System.out.println("z="+z);
}
}

Y10211064 黃耀葦 提到...

package 3233;

import java.util.*;

public class Aydln {
private static Scanner input;
public static void main(String[] args) {
Random rnd=new Random();
int z=rnd.nextInt(5);
int x=99;
while(x!=z){
System.out.println("輸入數字(0-4)");
input = new Scanner(System.in);
x=input.nextInt();
System.out.println(x);
if(x==1)
System.out.println("ONE");
else if(x==2)
System.out.println("TWO");
else if(x==3)
System.out.println("THREE");
else
System.out.println("其他");

}
System.out.println("z="+z);
}package sha;

import java.util.*;

public class sha1 {
private static Scanner input;
public static void main(String[] args) {
Random rnd=new Random();
int z=rnd.nextInt(5);
int x=99;
while(x!=z){
System.out.println("輸入數字(0-4)");
input = new Scanner(System.in);
x=input.nextInt();
System.out.println(x);
if(x==1)
System.out.println("ONE");
else if(x==2)
System.out.println("TWO");
else if(x==3)
System.out.println("THREE");
else
System.out.println("其他");

}
System.out.println("z="+z);
}

B10233110 徐上竣 提到...

package abcd1234;

import java.util.*;

public class abc123 {
private static Scanner input;
public static void main(String[] args) {
Random rnd=new Random();
int z=rnd.nextInt(5);
int x=99;
while(x!=z){
System.out.println("輸入數字(0-4)");
input = new Scanner(System.in);
x=input.nextInt();
System.out.println(x);
if(x==1)
System.out.println("ONE");
else if(x==2)
System.out.println("TWO");
else if(x==3)
System.out.println("THREE");
else
System.out.println("其他");

}
System.out.println("z="+z);
}

B10233087 黃少洋 提到...

package yyy222;

import java.util.*;

public class ssss222 {
private static Scanner input;
public static void main(String[] args) {
Random rnd=new Random();
int z=rnd.nextInt(5);
int x=99;
while(x!=z){
System.out.println("輸入數字(0-4)");
input = new Scanner(System.in);
x=input.nextInt();
System.out.println(x);
if(x==1)
System.out.println("ONE");
else if(x==2)
System.out.println("TWO");
else if(x==3)
System.out.println("THREE");
else
System.out.println("其他");

}
System.out.println("z="+z);
}

B10233082唐偉強 提到...

package fsda;

import java.util.*;

public class adf1 {
private static Scanner input;
public static void main(String[] args) {
Random rnd=new Random();
int z=rnd.nextInt(5);
int x=99;
while(x!=z){
System.out.println("輸入數字(0-4)");
input = new Scanner(System.in);
x=input.nextInt();
System.out.println(x);
if(x==1)
System.out.println("ONE");
else if(x==2)
System.out.println("TWO");
else if(x==3)
System.out.println("THREE");
else
System.out.println("其他");

}
System.out.println("z="+z);
}

B9933029江軒澔 提到...

import java.util.*;
public class hello {
private static Scanner input;
public static void main(String[] args) {
Random rnd=new Random();
int z=rnd.nextInt(5);
int x=99;
while(x!=z){
System.out.println("輸入數字:(0-4)");
input=new Scanner(System.in);
x=input.nextInt();
if (x==1)
System.out.println("ONE");
else if (x==2)
System.out.println("TWO");
else if (x==3)
System.out.println("THREE");
else
System.out.println("其他");
}
System.out.println("z="+z);
}
}

B9933029江軒澔 提到...

package ex325;
import java.util.*;
public class hello325 {
private static Scanner input;

public static void main(String[] args){
Random rnd=new Random();
int z=rnd.nextInt(5);
int x=99;
while (x!=z){
System.out.println("輸入數字:(0-4)");
input = new Scanner(System.in);
x=input.nextInt();
if (x==1)
System.out.println("ONE");
else if(x==2)
System.out.println("TWO");
else if(x==3)
System.out.println("THREE");
else
System.out.println("其他");
}
System.out.println("z="+z);
}

}

B10233073 楊博宇 提到...

package rgr;

import java.util.*;

public class rgr13 {
private static Scanner input;
public static void main(String[] args) {
Random rnd=new Random();
int z=rnd.nextInt(5);
int x=99;
while(x!=z){
System.out.println("輸入數字(0-4)");
input = new Scanner(System.in);
x=input.nextInt();
System.out.println(x);
if(x==1)
System.out.println("ONE");
else if(x==2)
System.out.println("TWO");
else if(x==3)
System.out.println("THREE");
else
System.out.println("其他");

}
System.out.println("z="+z);
}

B10233074 許逸憲 提到...

package ex325;
import java.util.*;
public class hello325 {
private static Scanner input;

public static void main(String[] args){
Random rnd=new Random();
int z=rnd.nextInt(5);
int x=99;
while (x!=z){
System.out.println("輸入數字:(0-4)");
input = new Scanner(System.in);
x=input.nextInt();
if (x==1)
System.out.println("ONE");
else if(x==2)
System.out.println("TWO");
else if(x==3)
System.out.println("THREE");
else
System.out.println("其他");
}
System.out.println("z="+z);
}

}

Related Posts Plugin for WordPress, Blogger...

熱門文章