Chapter 3 Code
Chapter 3 Code
/** * Created by Josh Trout * JAVA P.5 * 12/6/12 * * This Program prints out my name, my teachers name, my school, and a school team slogan to the console. * */ public class AboutMe { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub System.out.println("Josh Trout \nT.Smith \nSherwood High School \nGo Bowmen!"); } }
Console:
Josh Trout T.Smith Sherwood High School Go Bowmen!
AboutMe 2 of 2
/* * Created by Josh Trout * JAVA P.5 * 12/6/12 * * This Program prints out the schedule of this computer class into the console. * */ public class AboutMe_2 { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub System.out.format("%-10s %10s %8s", "Day", "Start", "End"); System.out.println(); System.out.println("------------------------------"); System.out.format("%-10s %10s %8s ", "Monday", "1:40", "2:50"); System.out.println(); System.out.format("%-10s %10s %8s ", "Tuesday", "1:40", "2:50"); System.out.println();
System.out.format("%-10s %10s %8s ", "Wednesday", "1:40", "2:50"); System.out.println(); System.out.format("%-10s %10s %8s ", "Thursday", "1:40", "2:50"); System.out.println(); System.out.format("%-10s %10s %8s ", "Friday", "1:40", "2:50");
} }
Console:
Day Start End -----------------------------Monday 1:40 2:50 Tuesday 1:40 2:50 Wednesday 1:40 2:50 Thursday 1:40 2:50 Friday 1:40 2:50