Skip to content

Commit e575d5f

Browse files
Jim FloresJim Flores
authored andcommitted
Added HelloMethods and Message.java examples for lesson 1.
1 parent 767d22f commit e575d5f

File tree

4 files changed

+32
-3
lines changed

4 files changed

+32
-3
lines changed

.vscode/settings.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"files.exclude": {
3+
"**/.classpath": true,
4+
"**/.project": true,
5+
"**/.settings": true,
6+
"**/.factorypath": true
7+
}
8+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
public class HelloMethods {
2+
3+
public static void main(String[] args) {
4+
String message = Message.getMessage("fr");
5+
System.out.println(message);
6+
}
7+
8+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
public class Message {
2+
3+
public static String getMessage(String lang) {
4+
5+
if (lang.equals("sp")) {
6+
return "¡Hola, Mundo!";
7+
} else if (lang.equals("fr")) {
8+
return "Bonjour, le monde!";
9+
} else {
10+
return "Hello, World!";
11+
}
12+
}
13+
}

src/org/launchcode/java/demos/javawebdevelopment/TempConv.java renamed to src/org/launchcode/java/demos/javawebdevelopment/data-types/TempConverter.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/**
66
* From "Java Web Development"
77
*/
8-
public class TempConv {
8+
public class TempConverter {
99
public static void main(String[] args) {
1010
double fahrenheit;
1111
double celsius;
@@ -16,8 +16,8 @@ public static void main(String[] args) {
1616
fahrenheit = input.nextDouble();
1717
input.close();
1818

19-
celsius = (fahrenheit - 32) * 5.0/9.0;
20-
System.out.println("The temperature in Celsius is: " + celsius + " degrees.");
19+
celsius = (fahrenheit - 32) * 5/9;
20+
System.out.println("The temperature in Celsius is: " + celsius + "°C.");
2121
}
2222

2323
}

0 commit comments

Comments
 (0)