4A

Your little brother wants to open a ice cream stand in front of your house. You are going to write a program to help him determine how much money he will make with different scenarios.

He can buy gaint tubs of ice cream with different measuraments. But all of the tubs are cylindical in shape. He can get ice cream scoops that create balls of ice cream of varius radius . He buys plain cones for 5 cents a piece. He sells a single dip ice cone for 3.25.

Create a class IceCreamStand that has a constructor that takes the height, radius and cost of the tub of ice cream and also the radius of the scoop. Be sure to specify the parameters in the correct order

Write these accessor methods

Write these mutator methods

Declare the price of a plain cone and the selling price of a scoop of ice cream as constants. Use public static final

Provide jvadoc

For the draft, provide instance variables, the constructor and the scoopVolume method. Do not use unnecessary instance variables.

4A draft:
4A final:

4B

Write a class with a main method. Call the class StringIO. There is no starter, you will write all the code.

Prompt the user to enter a string. Use this exact prompt for the draft: System.out.println("Enter a String: ");

Prompt the user to enter a string. Use this exact prompt for the final: System.out.print("Enter a String: ");

Prompt the user for a double. Use this exact prompt. System.out.println("Enter a number: ");

Prompt the user for a double. Use this exact prompt. System.out.print("Enter a number: ");

You usually do not have differnt prompts for draft and final but this time you do because I made a mistake.

I suggest copying and pasting the prompts so you have them exactly right.

On the first line print the number of characters in the string.

On the next line, print the string followed immediately by the number the user entered. Use a format with a width of 10 and 3 decimal places after the decimal. (You must use printf )

Concatenate the first 2 and the last 2 characters and print on the third line. (Assume the string has at least 3 characters.)

For the draft, read in the number and the string. Print both on the same line separated by "***" That is, you will print the number the user entered and then the string of 3 asterisks and finally the string the user entered all on one line

4B draft:
4B final:

4C

In this assignment you are going to enhance the Car class. You will add the functionality needed to keep of log of miles driven and gas added

Add this method to the Car class 

The method should return a string that shows each time miles are driven, each time gas is added, and the final gas tank level. We will assume that the drive never runs out of gas.

The string should have the following format:
Add: 16.0
Drive: 100.0
Add: 5.0
Drive: 150.0
Gas: 11.0

Notice you print the word, a colon, a space and then the value. I should get the same output if I call getLog () twice in a row.

You will need to add instance variable to hold the log. Call it log

You will also need to modify some other methods, as indicated by the //... in the Car class.

The reset() method resets the log to the empty string. This method is done for you.

To add a line to the log, form a string such as "Add: " + amount + "\n", and append it to the log string. (Notice the newline at the end)

You need to provide a javadoc comment for your method.

For the draft modify the addGas method to add the amount of gas to the log. Yoy only have to be able to handle the specal case where gas is added just one time.

4C draft:
4C final: