Checkpoint 1.47.1.
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 static 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 static void printProductStatus(int quantity) {
String status = "-----Blank1-----"; // Default value
if (quantity > 100) {
status = "High Stock";
} else if (quantity > 0) {
status = "In Stock";
}
System.out.println(------Blank2-----);
}
Put your responses here:
Blank 1:
Blank 2: