Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Heres the Java code for solution import javautilScanner public class SteakPurc...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started