Homework 3

Java Language Programming

 

bullet

Due in the class on Tuesday 11th of April 2000

bullet

Late submissions are not accepted

bullet

You can discuss this homework with others, but the submitted code must be yours

bullet

Write and test the following 4 Java programs and submit a hardcopy of your source code. Each program must be printed on a separate page. Don’t forget to write your name and registration number.

Problem 1

A) Write a program that prints three arguments taken from the command line.

B) Add comment documentation to this program. Extract this comment documentation into an HTML file using javadoc, view it with your Web browser, and obtain a hardcopy of what you see.


Problem 2

Write a program that prints values from 1 to 10.


Problem 3

A) Create a class with a default constructor (one that takes no arguments) that prints a message. Create an object of this class.

B) Add an overloaded constructor to this class that takes a String argument and prints it along with your message.

C) Create an array of object handles of this class, but don't actually create objects to assign into the array. When you run the program, notice whether the initialization messages from the constructor calls are printed.

D) Complete (C) by creating objects to attach to the array of handles. Only submit the last version of these classes.


Problem 4

Write a program that accepts one integer command line argument and prints the factorial of this integer.