4A

Java Wheat owns grain elevators. These grain elevators are tall cylinders use to store wheat. They are filled exactly to the top of the cylinder. Here is a picture.

grain elevator

We buy wheat from farmers and store it in our grain elevators. We pay $5 per cubic yard at the end of the harvest. And store the wheat until the next spring when we anticipate the price will be S7.50 a cubic yard. It cost $5000 in labor and miscellaneous expenses to store the wheat for 1 month.

You will complete the class GrainElevator. A GrainElevator has a constructor which takes the height and the radius of the cylinder in feet as parameters. height and width are specified in feet and in that order. You will write the constructor.

A GrainElevator has these methods

Provide Javadoc for the class, the constructor, every method, every parameter and every return value..

Declare constants for the buying price, selling price and monthly expenses. You would declare the buying price this way:

public static final double BUYING_PRICE = 5.0;

Notice you will need to convert units from square feet to square yards to calculate the labor cost. Use the constant provided.

public static final int CUBIC_FEET_PER_CUBIC_YARD = 9;

For the draft: Write the constructor to initialize the instance variables. Implement the other methods as stubs. Provide all the Javadoc

Note: The Javadoc for setRadius is not complete in the Codecheck starer file. It should read like this (2/11/16)

    /**
     * sets a new radius for this GrainElevator
     * @param theRadius the new radius
     */

4A draft:
4A final:

4B

Things like towels, shirts, and glassware are often personalized with a person's initials (monogrammed). You are to write a class Monogram.  A Monogram consists of a first name, middle initial (one letter. No period), and last name.

There is no starter file. You will write the whole class.

The Monogram class has two constructors (This is called overloading).

Monogram class has these methods

Provide full Javadoc (the class, the constructors, and the methods)

To get the first letter of a string word do this

    String firstLetter = word.substring(0,1);

For the draft, provide the instance variables, the first constructor and implement getFirstgetMiddleInitial, and getLast methods. Include the Javadoc for the implemented elements (class, constructor, and the three methods).

4B draft:
4B final:

4C

In this assignment you are going to enhance the Golfer class. You will add the functionality needed to keep track of scores for games played by the golfer.

Add these methods to the Golfer class 

Format of the String returned by getScoreRecord:

Game 1: 95
Game 2: 87
Game 3: 93
Game 4: 91
Average: 91.5

Notice you print the word Game, a space, the number of this game, a colon, a space, and then the value. I should get the same output if I call getScoreRecord () twice in a row.

You will need additional instance variables in the final. Think about what the class needs to remember to accomplish its tasks. Those are your instance variables. The constructor needs to initialize them.

To add a line to the record, form a String consisting of the word "Game " + the gameNumber + ": " + score + "\n". Concatenate it to the end of the record. (Notice the newline character at the end)

You need to provide a Javadoc comment for your methods.

For the draft, write the calculateScore method.

4C draft:
4C final: