{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

a08f1 - double a =(b h 2 println"a =" a Read...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
CS1MD3 08. 1 Assignment 1 Due . Sept. 23 (Tuesday), 23:59. 1. Type in the HelloProgram.java program exactly as it appears in the text book Figure 2-1, p. 25, and get it working. Add your name as a signature to the lower right corner. 2. The following program was written without comments or instructions to the user, except for a couple of input prompts: import acm.program.*; public class MyProgram extends ConsoleProgram { public void run() { double b = readDouble("Enter b: "); double h = readDouble("Enter h: ");
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: double a = (b * h) / 2; println("a = " + a); } } Read through the program and ±gure out what it is doing. What result is it calculating? Rewrite this program so it is easier to under-stand, both for the user and for the programmer who must modify the program in future. 3. Draw a ring of your favorite color at the center of the graphic window. You may make your drawing look nice, for example, add a shadow of the ring....
View Full Document

{[ snackBarMessage ]}