| |
Due by 8:00 AM on Monday, September 13, 1998
- The following program has a variety of syntactic and other errors.
/*
Program: HW02PR01
Author: Joshua S. Hodas /* A pretty smart guy! */
Date: September 26, 1996
Purpose: To print the gettysburg address
*/
class HW02PR01 {
public static void Main(String args[]) {
System.out.println("Four score and");
System.out.print(21.0/3.0);
System.out.print("years ago, ")
System.in.println("our fathers brought forth on this ");
System.out.println("continent a new nation.");
}
}
|
Fix them so that it successfully compiles and runs and prints:
Four score and 7 years ago,
our fathers brought forth on this
continent a new nation.
- Write a program that will print:
A program to print \n has at least 1 thing that is "hard to print",
but one that prints \\ has at least 2!
The program should not contain any uses of the numbers 1 or 2 as numeric or string literals.
- Modify the program
LiteralAreas
from the lecture so that in addition to the areas of the square and circle,
it also prints the volume of the cube of side 3 and the sphere of diameter 3.
The electronic submission system is now up. Follow the electronic submission
directions to turn in your homework.
|