1) Open a simple text editor and type in the following program:
public class HelloPrinter
public static void main(String args)
Open a console window and create an empty directory for your work. Save your work in a file called HelloPrinter.java. Pay attention to the case of letters in your program and in the name of the file. Compile your program from the console window by typing the following command:
What files are contained in the directory after you have compiled the program?
Java program file and class file.
Run your program by typing the following command:
What is the output of your program?
What is contained in the .class file?
When you have finished, try compiling and running the program from your IDE.
2) It’s ok to make errors. In fact, the more errors you make, the quicker you will become an expert Java programmer. Each error can teach you an important lesson. So … let’s make a few errors by experimenting with the HelloPrinter program from Lab 1.1.
a) Try deleting the only semicolon. What happens when you compile? Fix the error.
b) Try deleting the left brace under the main method and compiling your program. What happens? Fix the error.
c) Delete the first left brace in the program. What happens when you compile? Fix the program.
d) Change main to Main. Does the program compile? What happens if you run the program from the console window? What is the problem?
3) Imagine that it’s your job to count all the people attending a baseball game in Yankee Stadium and report the result to the stadium manager. There are many ways you could proceed. Pick one method and write your solution in pseudocode
4) Assume you are a bank manager and you want to teach the tellers in the bank how to count the paper currency in their teller drawers. Write pseudocode for a method of counting the money.
5) Imagine you have a box of rectangular blocks. Write some psuedocode that will instruct a person to stack twenty blocks into a rectangular array of four rows of five blocks as pictured below. Write the solution in a way that could be generalized easily to larger rectangles.
6) Imagine you have a box of rectangular blocks. Write some psuedocode that will instruct a person to stack fifteen blocks into the arrangement below. Write the solution in a way that can be generalized easily to larger arrangements.
7) Imagine you have a box of rectangular blocks. Write some psuedocode that will instruct a person to stack nine blocks into the arrangement below. Write the solution in a way that can be generalized easily to larger pyramids.