Question
You will be writing a Java application program that will read information about a person, and then will output clothing sizes for the person. Your
You will be writing a Java application program that will read information about a person, and then will output clothing sizes for the person.
Your program will begin by asking the user to enter the person's height, weight and age. After retrieving this information , the program will display a menu and ask the user to make a choice from the menu:
Calculate Hat Size
Calculate Jacket Size
Calculate Waist Size
No More Calculations
The user is expected to enter a value of 1, 2, 3 or 4. If the user does not enter one of these four values, the program should output an error message and ask the user to choose again. This process should continue until the user selects one of the menu options.
Once the user has selected one of the menu options, the program should perform the requested calculation and display the result on the screen. When the user chooses option 4, the program has finished with this particular user.
Next the program should ask if there is another person for which to calculate sizes. If the user answers yes, then the program should start over - asking for the next person's height, weight and age. If the user answers no, then the program should stop.
assignment part 1
There is already an existing class called Sizes, with an existing main method.
Inside the Sizes class, create a method called hatSize. The purpose of this method is to calculate a person's hat size.
Do not change any of the existing code in the main method, and do not add code to the main method. Changing the main method in any way will give you an automatic grade of zero on this part of the assignment.
This method should receive two integer parameters (in this order): weight and height. The method should calculate and return the hat size as a double value.
The hat size is calculated by dividing weight by height, and then multiplying by 2.9.
This method should NOT perform any screen output or keyboard input.
Testing:
The name of each test will tell you what parameter values are being passed to your method.
If your method is not written correctly (i.e. does not have the correct parameters or return value data types), then the tests will fail and will show nothing.
If your code does not compile, then the tests will fail and will show nothing.
If your method is written correctly, but returns the wrong value, then the test will show failed, and will tell you what value the method should be returning.
If your method is written correctly and returns the correct value, then the test will pass
assignment part 2
There is already an existing class called Sizes, with an existing main method.
Inside the Sizes class, create a method called jacketSize. The purpose of this method is to calculate a person's jacket size.
Do not change any of the existing code in the main method, and do not add code to the main method. Changing the main method in any way will give you an automatic grade of zero on this part of the assignment.
This method should receive three integer parameters (in this order): weight, height and age. The method should calculate and return the jacket size as a double value.
The jacket size is calculated by multiplying weight and height and then dividing the result by 288. After doing the base calculation for jacket size, the resulting answer must be adjusted by adding 1/8 of an inch for each 10 years of age, starting at age 40.
As an example, suppose that the weight times height produces an answer of 38.8 inches. If the age is 35, then the final answer will be 38.8 inches. If the age is 40, then the final answer will be 38.8 inches + (1/8 inch) = 38.925 inches If the age is 50, then the final answer will be 38.8 inches + (2/8 inch) = 39.05 inches
This method should NOT perform any screen output or keyboard input.
Testing:
The name of each test will tell you what parameter values are being passed to your method.
If your method is not written correctly (i.e. does not have the correct parameters or return value data types), then the tests will fail and will show nothing.
If your code does not compile, then the tests will fail and will show nothing.
If your method is written correctly, but returns the wrong value, then the test will show failed, and will tell you what value the method should be returning.
If your method is written correctly and returns the correct value, then the test will pass
assignment part 3
There is already an existing class called Sizes, with an existing main method.
Inside the Sizes class, create a method called waistSize. The purpose of this method is to calculate a person's waist size.
Do not change any of the existing code in the main method, and do not add code to the main method. Changing the main method in any way will give you an automatic grade of zero on this part of the assignment.
This method should receive two integer parameters (in this order): weight and age. The method should calculate and return the waist size as a double value.
The waist size is calculated by by dividing weight by 5.7. After doing the base calculation for waist size, the resulting answer must be adjusted by adding 1/10 of an inch for each 2 years of age, starting at age 30.
As an example, suppose that the weight divided by 5.7 produces an answer of 36.842 inches. If the age is 28 or 29, then the final answer will be of 36.842 inches. If the age is 30 or 31, then the final answer will be of 36.842 inches + (1/10 inch) = of 36.942 inches If the age is 32 or 33, then the final answer will be of 36.842 inches + (2/10 inch) = of 37.042 inches
This method should NOT perform any screen output or keyboard input.
Testing:
The name of each test will tell you what parameter values are being passed to your method.
If your method is not written correctly (i.e. does not have the correct parameters or return value data types), then the tests will fail and will show nothing.
If your code does not compile, then the tests will fail and will show nothing.
If your method is written correctly, but returns the wrong value, then the test will show failed, and will tell you what value the method should be returning.
If your method is written correctly and returns the correct value, then the test will pass
assignment part 4
There is already an existing class called Sizes, with an existing main method.
Inside the Sizes class, create a method called menu. The purpose of this method is to display the menu on the screen and allow the user to make a choice from the menu.
Do not change any of the existing code in the main method, and do not add code to the main method. Changing the main method in any way will give you an automatic grade of zero on this part of the assignment.
This method does not need to accept any parameters from the main method. Choices should be read into the menu method from the keyboard as a number 1, 2, 3 or 4. This method will need to contain a loop which will repeat the process of displaying the menu and getting an input value as long as the user does not enter a correct menu option. After a correct menu option has been entered, the method should return that choice back to the main method.
Note that this method is required to verify that the entered choice is correct, so the main method does not have to do that task.
The following is an example of what your MIGHT see on the screen when your menu method executes. The exact output depends on what values that the user types in while the program runs. The user's inputted values are shown below in italics. Note that your method must display the exact formatting shown here - including the spaces and blank lines.
1. Calculate Hat Size 2. Calculate Jacket Size 3. Calculate Waist Size 4. No More Calculations Enter your choice: 1
Here is another example:
1. Calculate Hat Size 2. Calculate Jacket Size 3. Calculate Waist Size 4. No More Calculations Enter your choice: 5 1. Calculate Hat Size 2. Calculate Jacket Size 3. Calculate Waist Size 4. No More Calculations Enter your choice: 3
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started