Question: Integers numSteaks and allowance are read from input. A steak costs 13 dollars. If numSteaks is greater than or equal to 5, then declare
Integers numSteaks and allowance are read from input. A steak costs 13 dollars. If numSteaks is greater than or equal to 5, then declare and initialize int variable totalCost with the product of numSteaks and 13. If totalCost is less than or equal to allowance, output "Approved transaction." Otherwise, output "Not enough money to buy all." If allowance is greater than or equal to 13, output "At least one item was purchased." If numSteaks is greater than 30, output "Restocking soon." Otherwise, output "Item still in stock." End with a newline. Ex: If the input is 16 258, then the output is: Approved transaction. At least one item was purchased. Item still in stock. 1 import java.util.Scanner; 2 3 public class SteakPurchases { 4 5 6 7 8 9 10 11 12 13 public static void main (String[] args) { Scanner scnr = new Scanner(System.in); int numSteaks; int allowance; numSteaks scnr. nextInt(); allowance scnr.nextInt(); *Your code goes here */
Step by Step Solution
3.32 Rating (155 Votes )
There are 3 Steps involved in it
Heres the Java code for solution import javautilScanner public class SteakPurc... View full answer
Get step-by-step solutions from verified subject matter experts
