Ok so i am writing a program to determine a users hat,jacket, and waist size. I have most of it done but i am still getting an error. Any help would be appreciated!
import java.util.*;
public class Sizes1 {
public static void main(String[] args) {
int answer = 0;
int choice = 0, height = 0, weight = 0, age = 0;
Scanner kbd = new Scanner(System.in);
getData(kbd, height, weight, age);
do {
choice = menu(kbd, height, weight, age);
switch (choice) {
case 1: displayHat(weight, height); break;
case 2: displayJacket(weight, height); break;
case 3: displayWaist(weight); break;
case 4: System.out.println("Is there another person for which to calculate sizes?" + " " + "(Y/N)");
answer = kbd.nextInt();
if( (answer == 'Y') || (answer == 'y')) {
menu(kbd, height, weight, age);
}
else if ((answer == 'N') || (answer == 'n')) {
System.out.print("Thanks");
}
}
} while ((answer != 'N') || (answer != 'n'));
}
public static void getData(Scanner kbd, int height, int weight, int age)
{
System.out.println("Enter your height (in inches):");
height = kbd.nextInt();
System.out.println("Enter your weight (in pounds):");
weight = kbd.nextInt();
System.out.println("Enter your age (in years):");
age = kbd.nextInt();
}
public static int menu(Scanner kbd, int height, int weight, int age)
{
int choice=0;
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.printf("\nEnter your choice:");
choice = kbd.nextInt();
return choice;
}
public static double hatSize(int weight, int height)
{
return (double)weight/height * 2.9;
}
public static void displayHat(int weight, int height)
{
System.out.printf("Your hat size is: %.3f inches \n" , hatSize(weight,height));
}
public static double jacketSize(int weight, int height)
{
return weight * height / 288.0;
}
public static void displayJacket(int weight, int height)
{
System.out.printf("Your jacket size is: %.3f inches \n" , jacketSize(weight,height));
}
public static double waistSize(int weight)
{
return weight / 5.7;
}
public static void displayWaist(int weight)
{
System.out.printf("Your waist size is: %.3f inches \n" , waistSize(weight));
}
}