Program 2 - Barbell

Goal Description Hints Passoff

Due Date - 21 Sept

Goal

 
  • Create a working Java program
  • Get information that the user types in
  • Print out information for the user
  • Do simple arithmetic
  • Create a simple 3D shape based on user input
 CS 142
Description
 

This program will ask the user for how much weight they want on their barbell. You will need to ask the user for the amount of weight that they want then print out what their answer was. You must then calculate the diameter of the weights that you need. The radius of each wieght should be the number of pounds for each wieght divided by 3.0. Remember there are two weights, one on each end. You should print out the calculated radius.

You should then display a 3D picture of your barbell wieghts of the correct diameter.

Steps

Print the following message on the screen

How much weight do you want?  

The user will then type a number that you will read and store in a variable.

Print the following message on the screen

You have asked for PPPP pounds.
Your weights will have radius RRRR.

Your console window should now look like this:

Console

Create a new 3D window

Display the barbell in the window.

It should like approximately like the picture below. The colors you can choose for yourself. I have included axes because it makes it easier to choose sizes but you can leave them out if you want.

Barbell

Hints
 

 

  • To create the bar, scale a cylinder to the right size, rotate about Z to get it onto the X axis and move it so that it is centered on the origin. I used a bar that was 6 in length and 0.5 radius.
  • To create each of the weights scale them by their radius in X and Z, and then scale Y by the thickness of the weight. These must then be rotated (about Z) and moved to the correct location on the ends of the bar. I used a weight thickness of 0.4.
  • I used Axes of length 6 and a look from point of (10,10,10).
  • My colors were Color.LIGHT_GRAY for the background, Color.GRAY for the bar and Color.DARK_GRAY for the weights.

Do each step one at a time and check the result before going on. Do not try to write the whole thing at once.

Passoff
 

__ 1) All code neatly indented

__ 1) Understandable variable names with proper style

__ 2) Radius is correctly calculated and presented

__ 3) An acceptable and realistic barbell appears

__ 1) The radius of the weights changes correctly with different user input

__ 1) The view is from an interesting look from point that is not the default.