Goal: Working with Java, print something to the screen.
/// Name: Cornelius Eanes
/// Period: 5
/// Program Name: Your First Program
/// File Name: FirstProg.java
/// Date Finished: Sep. 2, 2015
class FirstProg {
public static void main(String[] args) {
System.out.println("I am determined to learn coding.");
System.out.println("By the way, my name is Cornelius.");
}
}
Goal: Mess around with the System.out.println() method.
/// Name: Cornelius Eanes
/// Period: 5
/// Program Name: Your Second Program
/// File Name: GoodSecondProgram.java
/// Date Finished: Sep. 3, 2015
class GoodSecondProgram {
public static void main(String[] args) {
System.out.println("Hello world!");
System.out.println("More typing.");
System.out.println("I'm testing apostrophes.");
System.out.println("Printing backslashes requires another backslash before it: \\");
System.out.println("Same with quotation marks. \"See?\"");
System.out.println("You can force a new line to occur with \\n. \nHere's a new line!");
}
}
Goal: Figure out what comments are and how to make them.
/// Name: Cornelius Eanes
/// Period: 5
/// Program Name: Comments and Slashes
/// File Name: CommentsAndSlashes.java
/// Date Finished: Sep. 4, 2015
public class CommentsAndSlashes {
public static void main(String[] args) {
// This is a comment, which is ignored by the Java compiler.
// I could write code in this:
// System.out.println("This will not run.");
// and it won't work.
System.out.println("This isn't in a comment, and will run.");
// These comments, as you can see, are terminated after a new line.
}
}
Goal: Create an image of an addressed letter on the console.
/// Name: Cornelius Eanes
/// Period: 5
/// Program Name: Letter to Yourself
/// File Name: LetterToYourself.java
/// Date Finished: Sep. 4, 2015
public class LetterToYourself {
public static void main(String[] args) {
System.out.println("+------------------------------------------------------+");
System.out.println("| Cornelius Eanes |");
System.out.println("| 123 Main Street |");
System.out.println("| Walnut Creek, CA 94596 |");
System.out.println("| |");
System.out.println("| |");
System.out.println("| |");
System.out.println("| Bill Gates |");
System.out.println("| 1 Microsoft Way |");
System.out.println("| Redmond, WA 98104 |");
System.out.println("| |");
System.out.println("+------------------------------------------------------+");
}
}
Goal: Print your initials to the console.
/// Name: Cornelius Eanes
/// Period: 5
/// Program Name: Your Initials
/// File Name: MyInitials.java
/// Date Finished: Sep. 8, 2015
class MyInitials {
public static void main(String[] args) {
System.out.println(" CCC A EEEEE");
System.out.println("C C A A E");
System.out.println("C A A E");
System.out.println("C AAAAA EEE");
System.out.println("C C A A E");
System.out.println(" CCC A A EEEEE");
}
}
Goal: Play around with the System.out.print() method and figure out what it does.
/// Name: Cornelius Eanes
/// Period: 5
/// Program Name: Printing Choices
/// File Name: PrintingChoices.java
/// Date Finished: Sep. 8, 2015
class PrintingChoices {
public static void main(String[] args) {
System.out.print("My name is ");
System.out.println("Cornelius.");
System.out.print("Taco");
System.out.print("Ice Cream");
System.out.print("Sushi");
System.out.println();
System.out.println();
System.out.print("Taco");
System.out.println();
System.out.print("Ice Cream");
System.out.println();
System.out.print("Sushi");
System.out.println();
System.out.println("The \"System.out.println()\" method simply creates a new line");
System.out.println("after the provided text has been printed.");
}
}
Goal: Find out what escape sequences are and what purpose they serve.
/// Name: Cornelius Eanes
/// Period: 5
/// Program Name: Escape Sequences and More Comments
/// File Name: EscapeSequences.java
/// Date Finished: Sep. 8, 2015
public class EscapeSequences {
public static void main( String[] args ) {
// Initial version created using FIGlet, font "Big Money", oriented southwest
System.out.print( "\t _____\n\t / |\n\t JJJJJ |" );
System.out.println( " ______ __ __ ______" );
System.out.println( "\t JJ | / \\ / \\ / |/ \\" );
System.out.println( "\t __ JJ | aaaaaa |\"\" \\ /\"\"/ aaaaaa |" );
System.out.println( "\t/ | JJ | / aa | \"\" /\"\"/ / aa |" );
System.out.println( "\tJJ \\__JJ |/aaaaaaa | \"\" \"\"/ /aaaaaaa |" );
System.out.println( "\tJJ JJ/ aa aa | \"\"\"/ aa aa |" );
System.out.println( "\t JJJJJJ/ aaaaaaa/ \"/ aaaaaaa/" );
}
}
Goal: Figure out some basic math operations you can do in Java.
/// Name: Cornelius Eanes
/// Period: 5
/// Program Name: Numbers and Math
/// File Name: NumbersAndMath.java
/// Date Finished: Sep. 9, 2015
public class NumbersAndMath {
public static void main( String[] args ) {
// Addition
System.out.println("10 + 7 = " + (10 + 7));
// Subtraction
System.out.println("10 - 7 = " + (10 - 7));
// Multiplication
System.out.println("10 * 7 = " + (10 * 7));
// Division
System.out.println("10 / 7 = " + (10 / 7));
// Modulation
System.out.println("10 % 7 = " + (10 % 7));
// Greater than
System.out.println("10 > 7 = " + (10 > 7));
// Less than
System.out.println("10 < 7 = " + (10 < 7));
// Greater than or equal to
System.out.println("5 >= 5 = " + (5 >= 5));
// Less than or equal to
System.out.println("5 <= 5 = " + (5 <= 5));
}
}