Project 1 Shoe Size Chapters 2 Due Thursday November 10 201

Project 1: Shoe Size (Chapters 2 & Due: Thursday, November 10, 2016 A shoe manufacturer is attempting to cut costs by selling online. To that end, they would like to automate the conversion of foot length to shoe size for customers. You will write a Java program that performs that calculation. Sample Run Output of the program should look like (5 runs shown with user input in bold) 5 runs shown withm Runl Foot length (ex: 9.5 in or 24.1 cm) 25.3 CM W) omen\'s or M) en\' s m Your shoe size for our product is 8. Run2 Foot length (ex: 9.5 in or 24.1 cm): 9 in W) omen\'s or M)en\'s: W Your shoe size for our product is 7. Run3 Foot length (ex: 9.5 in or 24.1 cm 20 cm W) omen\'s or M) en\'s: w We apologize for not carrying your shoe size. Run4: Foot length (ex: 9.5 in or 24.1 cm) 300 mrm Unsupported foot length units: mm Run5: Foot length (ex: 9.5 in or 24.1 cm) 28 in W) omen\'s or M)en\'s: z Unknown shoe category: z Inputs Your program must accept input in the order and format shown in the above sample runs. Allow the user to enter length units (\"in\" or \"cm\") and well as the category (women\'s or men\'s) in any letter case Eg, \"In\" or \"cM\" and \"M\" or \"w\" should all work. CS1233-Java Programming- Fall 2016 Page 1 of3 1 of 3

Solution

class ShoeSize{
public static void main(String ah[]){
System.out.println(\"Foor length :\");
Scanner snr=new Scanner(System.in);
float size=snr.nextFloat();
String gen;
System.out.println(\"Enter Women/Men \");
gen=snr.next();


switch(gen.toUppercase()){
case M:getLengthMen(size);

case W:getLengthWomen(size);

default:return;
}
}

public void getLengthWoMen(float sz){
if(sz<20.2&&sz>27.5){
Syste.out.println(\"Not available\");
}else if(sz>20.2&&sz<=21.0){
Syste.out.println(\"5\");
}else if(sz>21.0&&sz<=21.8){
Syste.out.println(\"6\");
}else if(sz>22.6&&sz<=23.4){
Syste.out.println(\"7\");
}else if(sz>23.4&&sz<=24.2){
Syste.out.println(\"8\");
}else if(sz>24.2&&sz<=25.0){
Syste.out.println(\"9\");
}else if(sz>25.0&&sz<=25.8){
Syste.out.println(\"10\");
}else {
Syste.out.println(\"11\");
}
}

//this method is to get shoe
public void getLengthMen(float sz){
if(sz<23.2&&sz>30.5){
Syste.out.println(\"Not available\");
}else if(sz>24.8&&sz<=25.6){
Syste.out.println(\"7\");
}else if(sz>25.6&&sz<=26.4){
Syste.out.println(\"8\");
}else if(sz>26.4&&sz<=27.2){
Syste.out.println(\"9\");
}else if(sz>27.2&&sz<=28.0){
Syste.out.println(\"10\");
}else if(sz>28.0&&sz<=28.8){
Syste.out.println(\"11\");
}else if(sz>28.8&&sz<=30.5){
Syste.out.println(\"12\");
}else {
Syste.out.println(\"13\");
}
}

}

 Project 1: Shoe Size (Chapters 2 & Due: Thursday, November 10, 2016 A shoe manufacturer is attempting to cut costs by selling online. To that end, they wou
 Project 1: Shoe Size (Chapters 2 & Due: Thursday, November 10, 2016 A shoe manufacturer is attempting to cut costs by selling online. To that end, they wou

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site