Question: Integers numNectarines and allowance are read from input. A nectarine costs 3 dollars. If numNectarines is less than 4 , then output numNectarines is less
Integers numNectarines and allowance are read from input. A nectarine costs dollars.
If numNectarines is less than then output "numNectarines is less than the required amount to purchase."
If numNectarines is greater than or equal to then declare and initialize int variable totalCost with the product of numNectarines and
If totalCost is less than or equal to allowance, then output "Successful purchase!"
Otherwise, output "Not all nectarines purchased."
If numNectarines is greater than then output "Now out of stock."
Otherwise, output "Item still in stock."
End each output with a newline.
Click here for examples
import java.util.Scanner;
public class NectarinePurchases
public static void main String args
Scanner scnr new Scanner
System.in;
int numNectarines;
int allowance;
nufinNectarines scnr nextInt ;
allowance nextInt ;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
