Lab When submitting this lab, submit a .java file called ShirtSize, and create the following structure in Eclipse: Package Name: week4 Class Name: ShirtSize Sometimes it can be difficult to order a...


Lab









When submitting this lab, submit a .java file called ShirtSize, and create the following structure in Eclipse:




  • Package Name:week4


  • Class Name:ShirtSize


Sometimes it can be difficult to order a men’s shirt online. It would be helpful to have a program tell you what size shirt you should buy based on the measurement of the customer’s chest. Write a program that will ask the user for the customer’s chest size in inches. The program will then display what shirt size should be ordered. Use the following table to determine the appropriate shirt size:































Chest Measurement (in inches)




Shirt Size



Less than 38”



S



Greater than or equal to 38” and less than 40”



M



Greater than or equal to 40” and less than 43”



L



Greater than or equal to 43” and less than 46”



XL



Greater than or equal to 46”



XXL




The following steps will help you write the program:



Step 1:Using the Scanner, use an in.nextLine() statement to prompt the user for the measurement of the customer’s chest. Store the user's input into a variable called input



Step 2:Convert the user input into an integer using Integer.parseInt() and store the converted value into a variable called chestSize.



Step 3:Write an
if
statement that checks to see if
chestSize
is less than 38 inches.



Step 4:If step 2 is true, printthe appropriate shirt size (S).



Step 5:Use an
else if
statement to see if
chestSize
is greater than or equal to 38 inches and less than 40 inches. (Remember that&&is the 'and' operator)



Step 6:If step 4 is true, print the appropriate shirt size(M).



Step 7:Use an
else if
statement to see if
chestSize
is greater than or equal to 40 inches and less than 43 inches.



Step 8:If step 6 is true, print the appropriate shirt size (L).



Step 9:Use an
else if
statement to see if
chestSize
is greater than or equal to 43 inches and less than 46 inches.



Step 10:If step 8 is true, print the appropriate shirt size (XL).



Step 11:Use an
else
statement to print the appropriate shirt size (XXL) of none of the above conditions are true.



Example Run










In this program, we will determine a man's shirt size based on the measurement in inches of the customer's chest.


Please enter the customer's chest measurement in inches:


30


A customer with a chest measurement of 30 inches needs to order a size S.



----------------------------



In this program, we will determine a man's shirt size\ based on the measurement in inches of the customer's chest.


Please enter the customer's chest measurement in inches:


38


A customer with a chest measurement of 38 inches needs to order a size M.



----------------------------



In this program, we will determine a man's shirt size\ based on the measurement in inches of the customer's chest.


Please enter the customer's chest measurement in inches:


41


A customer with a chest measurement of 41 inches needs to order a size L.



----------------------------



In this program, we will determine a man's shirt size\ based on the measurement in inches of the customer's chest.


Please enter the customer's chest measurement in inches:


44


A customer with a chest measurement of 44 inches needs to order a size XL.



----------------------------



In this program, we will determine a man's shirt size\ based on the measurement in inches of the customer's chest.


Please enter the customer's chest measurement in inches:


46


A customer with a chest measurement of 46 inches needs to order a size XXL.


Jan 26, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here