Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

project help below is the existing code with the the four differrent methods to calculate the hat,jacket AND WAISTE SIZE. i need helpd on adding

project helpimage text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

below is the existing code with the the four differrent methods to calculate the hat,jacket AND WAISTE SIZE. i need helpd on adding all the methods together and making the program work correctily

import java.util.*;

public class Sizes {

public static Scanner kbd;

public static void main(String[] args) {

kbd = new Scanner(System.in);

System.out.println("Enter you height in (in inches):");

int inches=kbd.nextInt();

System.out.println("Enter your weight (in pounds):");

int pounds=kbd.nextInt();

System.out.println("Enter your age (in years):");

int age=kbd.nextInt();

System.out.println("Begin test");

int choice=menu();

if(choice==1)

System.out.println("Hat size is "+hatSize(1,1));

else if(choice==2)

System.out.println("Jacket size is "+jacketSize(1,1,1));

else if(choice==3)

System.out.println("Waist size is "+waistSize(1,1));

else if(choice==4)

System.out.println("Test complete");

}

public static double hatSize(double weight, double height) {

double ans;

ans = (weight/height) *2.9;

return ans;

}

public static double jacketSize(int weight, int height, int age) {//Three parameters returning to jacketsize

double mul = weight*height;

mul = mul/288;//calculations to get jacket size

while(age >= 40) {//startin at he age of 40

mul = mul + 1.0/8.0;

age = age - 10;//adjusted 1/8 of inch for every 10 years

}

return mul;

}

public static double waistSize( int weight, int age ) {//two paramters, returning to waistSize

double answer= weight/5.7;

while(age>=30) {

answer=answer + 1.0/10.0;//starting at age 40, adjusted for every 10 years

age=age - 2;

}

return answer;

}

public static int menu() {

// Display the menu

while (true) {

System.out.println();

System.out.println("1. Calculate Hat Size");

System.out.println("2. Calculate Jacket Size");

System.out.println("3. Calculate Waist Size");

System.out.println("4. No More Calculations");

System.out.print(" Enter your choice: ");

// read user input

int n = kbd.nextInt();

// if a valid option, return it to main()

//else while loop repeats

if (n >= 1 && n

return n;

}

kbd.close();

}

}

}

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: 1. Calculate Hat Size 2. Calculate Jacket Size 3. Calculate Waist Size 4. 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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals, Design, and Implementation

Authors: David M. Kroenke, David J. Auer

14th edition

133876705, 9781292107639, 1292107634, 978-0133876703

More Books

Students also viewed these Databases questions

Question

How do Dimensional Database Models differ from Relational Models?

Answered: 1 week ago

Question

What type of processing do Relational Databases support?

Answered: 1 week ago

Question

Describe several aggregation operators.

Answered: 1 week ago