Home /
Expert Answers /
Computer Science /
correct-me-pls-integer-variables-numbananas-and-allowance-are-read-from-input-a-banana-costs-2-dol-pa932
(Solved): correct me pls! Integer variables numBananas and allowance are read from input. A banana costs 2 dol ...
correct me pls!
Integer variables numBananas and allowance are read from input. A banana costs 2 dollars. - If numBananas is less than 6 , output "numBananas requires at least 6 to purchase:. - If numBananas is greater than or equal to 6 , then multiply numBananas by 2. - If the product of numBananas and 2 is less than or equal to allowance, output "Successful purchasel". - Otherwise, output "Need more money to purchase all.". - If allowance is greater than or equal to 2 , output "At least one item was purchased." End with a newline. Ex: If the input is 827 , then the output is: Successful purchase! At least one item was purchased.
Ex: If the input is 827 , then the output is: Successful purchase! At least one item was purchased. 12 The first if-else statement checks the number of bananas purchased. If at least 6 bananas are purchased, then a nested if-else statement compares the cost of the bananas to the amount of money read from input.
Ex: If the input is 827 , then the output is: Successful purchase! At least one item was purchased. 1 The first if-else statement checks the number of bananas purchased. If at least 6 bananas are purchased, then a nested if-else statement compares the cost of the bananas to the amount of money read from input. Next another nested if statement comnares the amount of monev rear from innut to the cost of nne hanana
The first if-else statement checks the number of bananas purchased. If at least 6 bananas are purchased, then a nested if-else statement compares the cost of the bananas to the amount of money read from input. Next, another nested if statement compares the amount of money read from input to the cost of one banana. Not all tests passed. 1. Compare output n Input Your output ×2 Compare output ? Output differs. See highlights below. Input Expected output numbananas requires at least 6 to purchase.
Expected output 3: Compare output A Input Your output 4. Compare output ? Input Your output 5. Compare output ? Input Your output