Checkpoint 1.16.2.
Improve the style of
printProductStatus()
. The original function is below, followed by a version with two blanks. Fill in the blanks so that the original functionality is preserved, but the code is easier to maintain.public void printProductStatus(int quantity) {
String status = "";
if (quantity > 100) {
status = "High Stock";
System.out.println("Status: " + status);
} else if (quantity > 0) {
status = "In Stock";
System.out.println("Status: " + status);
} else {
status = "Out of Stock";
System.out.println("Status: " + status);
}
}
public void printProductStatus(int quantity) {
String status = "";
if (quantity > 100) {
status = "High Stock";
} else if (quantity > 0) {
status = "In Stock";
} else {
status = "-----Blank1-----";
}
System.out.println(------Blank2-----);
}
Put your responses here:
Blank 1:
Blank 2: