Question: The first statement is an if statement: If numChickens > = 4 evaluates to true, then: totalCost is declared and initialized with the product of

The first statement is an if statement:
If numChickens >=4 evaluates to true, then:
totalCost is declared and initialized with the product of numChickens and 9.
A nested if-else statement is next:
If totalCost <= allowance evaluates to true, then "Chickens successfully purchased." is output.
Otherwise, "Need more money to purchase all." is output.
Lastly, a nested if statement follows:
If allowance >=9 evaluates to true, then "At least one item was purchased." is output.
The second statement is an if statement:
If numChickens >25 evaluates to true, then "Restocking soon." is output.
Not all tests passed.
1: Compare output
Input
87833
Your output
Chickens successfully purchased.
At least one item was purchased.
Restocking soon.
2: Compare output
Input
1161022
Your output
Need more money to purchase all.
At least one item was purchased.
Restocking soon.
3: Compare output
Input
623
Your output
Need more money to purchase all.
Restocking soon.
4: Compare output
Input
22211
Your output
Chickens successfully purchased.
At least one item was purchased.
5: Compare output
Input
22145
Your output
Need more money to purchase all.
At least one item was purchased.
6: Compare output
Input
0100
Your output
At least one item was purchased.
Expected output
This test case should produce no output
7: Compare output
Input
154
Your output
Need more money to purchase all.
8: Compare output
Input
414
Your output
Need more money to purchase all.
At least one item was purchased.
9: Compare output
Input
24216
Your output
Chickens successfully purchased.
At least one item was purchased.
10: Compare output
Input
639
Your output
Need more money to purchase all.
At least one item was purchased.
Restocking soon.
11: Compare output
Input
2516
Your output
Need more money to purchase all.
At least one item was purchased.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!