CS256: Lab 6


Due: See Moodle for the due date and time

Goals

1. Learn to use primitive types

2. More experience declaring and calling methods

Requirements

1. In this lab, you will implement all of the methods in a one class named Lab6.

Here is the documentation for the Lab6 class.  Implement all of the methods shown in the method Detail section.  You can test each method individually by using the green and white square icon in JGrasp.

 

Please do user input using IO.java.

 

NOTE: lab 6 uses the ‘new’ primitive types: long, char, boolean

 

2. Write answers to the following questions in a comment at the top of your Lab6.java file:

·         All of the methods in the Lab6 class work together.  State the ‘chain’ of method calls, i.e., which method is called when the program starts, then which method does this method call, etc..

·         In order to implement numOunces(), you need to call which method in the Math class?

·         Consider the following statement:

int k = (int) numOunces(IO.readDouble("Your double > "));

Will k ever have a different value than the value returned by the method numOunces()?

If so, give an example.

 

3. Thoroughly test your methods, then turn in your lab using the autograder

The autograder advertises what the inputs and outputs should be.  All outputs that the autograder advertises that it is expecting must be printed using System.out.println() all other outputs must be printed using System.err.println() in order to pass the autograder.  Lab6.main() is the only method that requires any printed output. 

 

Note:  The autograder will give a score of up to 100 for the ‘functional’ portion of the lab.  From this score, I will remove points for: missing name at the top of the code, poor indentation, poorly structured code, missing or incorrect synthesis question answers.