Skip to content

Commit 30337c4

Browse files
authored
Add files via upload
1 parent 82ead20 commit 30337c4

14 files changed

+108
-0
lines changed

Addition.class

475 Bytes
Binary file not shown.

Addition.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Tristan Goodell
2+
// contact@tgoodell.com
3+
// listing 2.3
4+
5+
public class Addition {
6+
public static void main (String[] args) {
7+
System.out.println ("24 and 45 concatenated: " + 24 + 45);
8+
System.out.println ("24 and 45 added: " + (24 + 45));
9+
}
10+
}

Countdown.class

586 Bytes
Binary file not shown.

Countdown.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Tristan Goodell
2+
// contact@tgoodell.com
3+
// listing 2.1
4+
5+
public class Countdown {
6+
public static void main (String[] args) {
7+
System.out.print ("Three... ");
8+
System.out.print ("Two... ");
9+
System.out.print ("One... ");
10+
System.out.print ("Zero... ");
11+
12+
System.out.println ("Liftoff!");
13+
System.out.println ("Houston, we have a problem.");
14+
}
15+
}

Facts.class

721 Bytes
Binary file not shown.

Facts.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Tristan Goodell
2+
// contact@tgoodell.com
3+
// listing 2.2
4+
5+
public class Facts {
6+
public static void main (String[] args) {
7+
System.out.println ("We present the following facts for your " + "extracurricular education:");
8+
System.out.println ();
9+
System.out.println ("Letters in the Hawaiian alphabet: 12");
10+
System.out.println ("Dialing code for Antartica: " + 672);
11+
System.out.println ("Year in which Leonardo da Vinci invented " + "the parachute: " + 1515);
12+
System.out.println ("Speed of ketchup: " + 40 + " km per year");
13+
}
14+
}

Geometry.class

993 Bytes
Binary file not shown.

Geometry.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Tristan Goodell
2+
// contact@tgoodell.com
3+
// listing 2.6
4+
5+
public class Geometry {
6+
public static void main(String[] args) {
7+
int sides = 7;
8+
System.out.println ("A heptagon has " + sides + " sides.");
9+
10+
sides = 10;
11+
System.out.println ("A decagon has " + sides + " sides.");
12+
13+
sides = 12;
14+
System.out.println ("A dodecagon has " + sides + " sides.");
15+
}
16+
}

PianoKeys.class

865 Bytes
Binary file not shown.

PianoKeys.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Tristan Goodell
2+
// contact@tgoodell.com
3+
// listing 2.5
4+
5+
public class PianoKeys {
6+
public static void main (String[] args) {
7+
int keys = 88;
8+
System.out.println ("A piano has " + keys + " keys.");
9+
}
10+
}

RandomNumbers.class

1.3 KB
Binary file not shown.

RandomNumbers.java

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Tristan Goodell
2+
// contact@tgoodell.com
3+
// listing 2.9
4+
5+
import java.util.Random;
6+
7+
public class RandomNumbers {
8+
public static void main (String[] args) {
9+
Random generator = new Random();
10+
int num1;
11+
double num2;
12+
13+
num1 = generator.nextInt(10);
14+
System.out.println ("From 0 to 9: " + num1);
15+
16+
num1 = generator.nextInt(10) +1;
17+
System.out.println ("From 1 to 10: " + num1);
18+
19+
num1 = generator.nextInt(15) + 20;
20+
System.out.println ("From 20 to 34: " + num1);
21+
22+
num1 = generator.nextInt(20) -10;
23+
System.out.println ("From -10 to 9: " + num1);
24+
25+
num2 = generator.nextDouble();
26+
System.out.println ("A random double [between 0-1]: " + num2);
27+
28+
num2 = generator.nextDouble() * 5;
29+
num1 = (int) num2 + 1;
30+
System.out.println ("From 1 to 6: " + num1);
31+
}
32+
}

Roses.class

554 Bytes
Binary file not shown.

Roses.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Tristan Goodell
2+
// contact@tgoodell.com
3+
// listing 2.4
4+
5+
public class Roses {
6+
public static void main (String[] args) {
7+
System.out.println ("Roses are red, \n\tViolets are blue,\n" +
8+
"Sugar is sweet,\n\tBut I have \"commitment issues\",\n\t" +
9+
"So I'd rather just be friends\n\tAt this point in our relationship.");
10+
}
11+
}

0 commit comments

Comments
 (0)