Created
May 13, 2014 01:30
-
-
Save siritori/d3f47e23223f185dd9c2 to your computer and use it in GitHub Desktop.
情報科学I
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Letter | |
{ | |
public static void main(String args[]) { | |
char ch = args[0].charAt(0); | |
System.out.println("Input a letter[A-E] : " + ch); | |
switch(ch) { | |
case 'A': | |
System.out.println("Excellent"); | |
break; | |
case 'B': | |
System.out.println("Very Good"); | |
break; | |
case 'C': | |
System.out.println("Good"); | |
break; | |
case 'D': | |
System.out.println("Fair"); | |
break; | |
case 'E': | |
System.out.println("Poor"); | |
break; | |
default: | |
System.err.println("letter error : Unknown character '" + ch + "'"); | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ScopeOfNum | |
{ | |
public static void main(String args[]) { | |
int num = Integer.parseInt(args[0]); | |
if(num >= 0 && num < 10) { | |
System.out.println(num + " is OK"); | |
} else { | |
System.out.println(num + " is NG"); | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Star | |
{ | |
public static void main(String args[]) { | |
int num_stars = Integer.parseInt(args[0]); | |
System.out.println("input number : " + num_stars); | |
for(int i = 0; i < num_stars; i++) System.out.print("*"); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Star2 | |
{ | |
public static void main(String args[]) { | |
int num_stars = Integer.parseInt(args[0]); | |
System.out.println("input number : " + num_stars); | |
int i = 0; | |
while(i < num_stars) { | |
System.out.print("*"); | |
i++; | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Star3 | |
{ | |
public static void main(String args[]) { | |
int num_stars = Integer.parseInt(args[0]); | |
System.out.println("input number : " + num_stars); | |
int i = 0; | |
while(true) { | |
if(i == num_stars) break; | |
System.out.print("*"); | |
i++; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment