Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Use scnr to read each pair of inputs, integer currQuantity and string currFood, until - 9 9 9 is read from input. Create each Order
Use scnr to read each pair of inputs, integer currQuantity and string currFood, until is read from input. Create each Order object with currQuantity and currFood as arguments and append each object to ArrayList orderList. import java.util.Scanner;
import java.util.ArrayList;
public class Orders
public static void mainString args
Scanner scnr new ScannerSystemin;
ArrayList orderList new ArrayList;
Order currOrder;
int currQuantity;
String currFood;
int i;
Your code goes here
for i ; i orderList.size; i
currOrder orderList.geti;
currOrder.print;
public class Order
private int quantity;
private String food;
public void setQuantityAndFoodint newQuantity, String newFood
quantity newQuantity;
food newFood;
public void print
System.out.printlnOrder quantity: quantity Food: food;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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