In this project, you will create a Java program that asks a customer at a clothing store for his waist measurement. Based on his response, you will tell him his pant size is small, medium, or large. You will write this code twice, once using a switch-case statement and once using nested if statements.
( PLEASE HELP, THIS IS MAKING ACTUAL CODE THEY NEVER TAUGHT ME HOW TO CODE SO I DONT KNOW HOW TO, THE CODE DOESN'T NEED TO BE RIGHT IT JUST NEEDS TO LOOK LIKE IT )

Answers

Answer 1
import java.util.Scanner;

public class WaistSize {

public static void main(String[] args) {
Scanner input = new Scanner(System.in);

System.out.println("What is the measurement of your waist in inches?");
int waistSize = input.nextInt();

String sizeGuideA = sizeGuide1(waistSize);
String sizeGuideB = sizeGuide2(waistSize);

System.out.println("Nested If Statements return: " + sizeGuideA);
System.out.println("Switch-Case Statements return: " + sizeGuideB);

}
public static String sizeGuide1(int n) {
String size = "null";

if(n <= 25) {
return size = "Extra Small";
}

if(n > 25 && n <= 28) {
return size = "Small";
}

if(n > 28 && n <= 30) {
return size = "Medium";
}

if(n > 30 && n <= 32) {
return size = "Large";
}
else {
return "Error";
}
}

public static String sizeGuide2(int n) {
String size = "null";

switch(n) {
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
case 10:
case 11:
case 12:
case 13:
case 14:
case 15:
case 16:
case 17:
case 18:
case 19:
case 20:
case 21:
case 22:
case 23:
case 24:
case 25:
size = "Extra Small";
size = "Extra Small";
break;
case 26:
case 27:
case 28:
size = "Small";
break;
case 29:
case 30:
size = "Medium";
break;
case 31:
case 32:
size = "Large";
break;


}

return size;
}
}

Related Questions

Other Questions
what expression is equivalent to 9+7x-3y what is the Riemann hypothesis Which of the following shapes are squares ? Please choose 2 correct answers !!!!!!!!!!!!! Will mark Brianliest !!!!!!!!!!!!!!!!! does anybody know how to unlock websites from school computer Pleaseeeeeeee helppp 3. What is the sum of the interior angles of a polygon with 32 sides? ASAPI NEED THIS NOWWW Has this video prompted you to make any changes in the way that you view or manage your personal finances? Do you think it will impact how you handle your personal finances in the future? Explain. PLZ HELP IF YOU ABSWER ALL RIGHT I GIVE BRAINLEST How is the earthworm beneficial to the formation of soil?A)They eat soil.B)They digest soil.C)They mix soil.D)They aerate soil.E)All of the above. 1 free pass to heaven if you help and get it right When Ronan finished school and was starting a new job in his chosen profession, his parents decided that it was time for him to marry. They chose a bride who came from a family wtih the same amount of wealth and who belonged to the same class. Ronan and his bride will have what type of marriage: Re write each sentence using a semicolon Madison left for the soccer game but it was rained out.The dog chased the cat but the cat ran up a tree for safety. Identify the term for each of the following abbreviations:MINMAXG.C.N.I.CELEV -1=5+x/6 step by step 5. Which plate boundary produces mountains?a. Transformb. Convergent: continental to continentalc. Convergent oceanic to oceanicd. Convergent continental to oceanice. Divergent. This battle was the last battle of the Civil War on May 12 & 13, 1865.A. Battle of the AlamoB. Battle of Palmito RanchC. Battle of Sabine PassD. Battle of Galveston Which of these statements would be supported by a utopian socialist but not a communist?A)The industrial working class is oppressed and exploited by the wealthy ownership classB)The gains of the Industrial Revolution should be shared by all members of societyC)Governments have not rights to restrict the action of businesses or customersD)Society will shift toward a socialist ideals without the need for violent revolution What do drilling and mining for nonrenewable energy sources have in common?They are only used in a few countries.They remove CO. from the atmosphere.They can pollute and harm the environment,O They stop methane gas from being released. The length of the longer leg of a right triangle is 4ft more than twice the length of the shorter leg. The length of the hypotenuse is 6ft more than twice the length of the shorter leg. Find the side lengths of the triangle.a. Find the length of the shorter sideb. Find the length of the longer sidec. Find the length of the hypotenused. Find the side lengths of the triangle.