Restore
This commit is contained in:
10
Labs/Lab2/Lab2Part1/Question5/.classpath
Normal file
10
Labs/Lab2/Lab2Part1/Question5/.classpath
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
17
Labs/Lab2/Lab2Part1/Question5/.project
Normal file
17
Labs/Lab2/Lab2Part1/Question5/.project
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>Question5</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding/<project>=UTF-8
|
||||
BIN
Labs/Lab2/Lab2Part1/Question5/bin/PrintNumberInWord.class
Normal file
BIN
Labs/Lab2/Lab2Part1/Question5/bin/PrintNumberInWord.class
Normal file
Binary file not shown.
46
Labs/Lab2/Lab2Part1/Question5/src/PrintNumberInWord.java
Normal file
46
Labs/Lab2/Lab2Part1/Question5/src/PrintNumberInWord.java
Normal file
@@ -0,0 +1,46 @@
|
||||
|
||||
public class PrintNumberInWord {
|
||||
|
||||
public static void main(String[] args) {
|
||||
int number = 8;
|
||||
|
||||
if(number < 0 || number > 9) {
|
||||
System.out.println("OTHER");
|
||||
}
|
||||
else {
|
||||
if(number == 1) System.out.println("ONE");
|
||||
if(number == 2) System.out.println("TWO");
|
||||
if(number == 3) System.out.println("THREE");
|
||||
if(number == 4) System.out.println("FOUR");
|
||||
if(number == 5) System.out.println("FIVE");
|
||||
if(number == 6) System.out.println("SIX");
|
||||
if(number == 7) System.out.println("SEVEN");
|
||||
if(number == 8) System.out.println("EIGHT");
|
||||
if(number == 9) System.out.println("NINE");
|
||||
}
|
||||
|
||||
switch(number) {
|
||||
case 1:System.out.println("ONE");
|
||||
break;
|
||||
case 2:System.out.println("TWO");
|
||||
break;
|
||||
case 3:System.out.println("THREE");
|
||||
break;
|
||||
case 4:System.out.println("FOUR");
|
||||
break;
|
||||
case 5:System.out.println("FIVE");
|
||||
break;
|
||||
case 6:System.out.println("SIX");
|
||||
break;
|
||||
case 7:System.out.println("SEVEN");
|
||||
break;
|
||||
case 8:System.out.println("EIGHT");
|
||||
break;
|
||||
case 9:System.out.println("NINE");
|
||||
break;
|
||||
default:System.out.println("OTHER");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user