Trial Lab (CS1101 AY2008/9 Semester 1)

This lab assignment is not graded.

Date of release: 19 August 2008, Tuesday, 23:59.

Submission deadline: 27 August 2008, Wednesday, 23:59.

School of Computing, National University of Singapore

This trial lab is for you to **test out the CourseMarker
system
and to iron out any problem** before we start the
first lab assignment in week 4. This trial lab is not graded.

For more information on CourseMarker, please refer to CS1101X lab page and CS1101X IVLE forum. (CS1101X IVLE forum is open to all students. If you are not taking CS1101X, you can bookmark it in IVLE to access the forum.)

You may assume that **all input data are correct**.

In general, you should use `Scanner` class on `System.in` for
input and `System.out` for output in your programs,
unless otherwise stated.

**Test your programs thoroughly with your own input data before you
submit to CourseMarker.** Do not use CourseMarker as a debugging tool.
For this trial lab, the number of submissions is set to **99**.

If you have any questions, you may post your queries in the IVLE forum of your respective lecture group.

**Important!**

Please use this trial lab to test out the CourseMarker
system to ensure that it works before actual lab starts
in week 4. For installation details, please refer to the
CourseMarker website.
If you have problem with the installation, you may
post your queries in the IVLE forum of your
respective lecture group,
email **cmarker@comp.nus.edu.sg**,
or approach the **Technical Services** counter
at the ground floor of COM1.

- Standard input and output. (Textbook sections 3.7, 3.23)
- The
`int`data type. (Textbook sections 3.10, 3.13) - Simple arithmetic computation on integers. (Textbook section 3.15)

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

You may assume that the volume of the cube does not exceed the
maximum value representable in the `int` data type.
(What is that maximum value?)

Sample run using interactive input (user's input shown in blue; output shown in bold purple):

$ javac Cube.java $ java Cube Enter length: 12 Enter width : 3 Enter height: 10Volume = 360

Submit your program through CourseMarker.

- It may seem that this lab requires knowledge in Chapter 3
which is not yet covered. Do not fret. Your will be given
a skeleton program which is almost complete. You just need
to correct two statements in the program.

- A skeleton file is provided here:
Cube.java

- CourseMarker awards mark for correctness ONLY if your output
adheres to the given format. Hence,
do not add any other characters (such as blanks) that are not asked
for in your output, or change the spelling in your output.
The following outputs will all be graded as incorrect for
the above example:

`volume = 360`(reason: "Volume" misspelt as "volume")`Volume=360`(reason: spaces around = sign missing)`Volume = 360`(reason: too many spaces around = sign)`Volume = 360.`(reason: additional dot at end of line)

- Note that your program will be tested with a number of test data
sets, which are DIFFERENT from the given example.

- This trial lab is for your familiarisation with CourseMarker. Marks awarded for this lab will not be recorded.

You may want to explore more since you are new in programming. You can try the following suggestions just for your own practice (do not submit to CourseMarker!). The suggestions are independent of one another. You may try other changes on your own. You may discuss your observation with your discussion leader.

- You use
`int`type for the volume in this program. You have learned in class that`int`type uses 32 bits. Can you try some input values such that the program 'bombs' (terminates with error) because the computed volume is larger than what int`type`can hold. - Use the
`double`type instead of`int`type in your program. - Compute the perimeter of the cube.
- Compute the surface area of the cube.

The deadline for handing in all programs is **27 August 2008, Wednesday,
23:59**. Late submissions will NOT be accepted.

tantc@comp.nus.edu.sg

Tue Aug 19 20:24:22 SGT 2008