CS305j, Introduction to Computing Discussion section handout #1 1. Write a sequence of Java statements, just the printlns, not the whole program, that produces the following output: Programming languages can be difficult to pick up. There are strict rules of syntax. There are rule and exceptions to the rules. Single quotes: ', Double quotes: " Escape sequences: \" (Why is it called an "escape" sequence?) 2. What is the output of the following Java program when it is run? public class Trace{ public static void main(String[] args){ System.out.println("start in main"); methodA(); System.out.println("main"); methodC(); System.out.println("main"); methodD(); System.out.println("ending in main"); } public static void methodA(){ System.out.println("A"); } public static void methodB(){ methodA(); System.out.println("B"); } public static void methodC(){ methodB(); System.out.println("C"); methodB(); methodA(); } public static void methodD(){ System.out.println("D"); methodC(); methodA(); methodB(); } } 3. Most of you just arrived on campus in the past month. What were the steps involved in getting your room (whether in a dorm, apartment, or house) set up? Write out as a set of instructions all of the steps necessary to get all of your stuff from your previous residence to your current residence. Structure the instructions and see if you can remove any redundancies. 4. Write a complete Java program that produces the following output. Create a program with structure and try to remove redundancy using static methods # # # # ###### # # ********** * | | * * | | * ********** * | | * * | | * ********** * | | * * | UT | * * | | * ********** * | | * * | | * ********** * | | * * | | * ********** # # # # ###### # #