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 3 dollars.
If numNectarines is less than 4, then output "numNectarines is less than the required amount to purchase."
If numNectarines is greater than or equal to 4, then declare and initialize int variable totalCost with the product of numNectarines and 3.
If totalCost is less than or equal to allowance, then output "Successful purchase!"
Otherwise, output "Not all nectarines purchased."
If numNectarines is greater than 24, 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 =scnr. nextInt () ;
 Integers numNectarines and allowance are read from input. A nectarine costs

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!