Monday, March 2, 2009

Files for Java Training 2 March 09

Download the files from here:
  1. Lab0Q1.java (Answer for Q1)
  2. Lab0Q2.java (Answer for Q2)
  3. Lab0Q3.java (Answer for Q3)
Students can visit http://java.sun.com/javase/6/docs/api to read up on how to use the various java classes (e.g. those in Q1-3 of Lab0).

The main question for this training:

Write a program that reads three positive integers representing the length, width and height of a cube, and computes the volume of the cube.

Sample output:

C:\javac Cube.java
C:\java Cube

Enter length: 12
Enter width : 3
Enter height: 10
Volume = 360

No comments:

Post a Comment