Question
: In this lab, you will write a short Java application that uses a loop control structure. Specifically, your application should accomplish the following: Create
: In this lab, you will write a short Java application that uses a loop control structure.
Specifically, your application should accomplish the following:
Create an ArrayList to store the list of ingredient names added by the user.
Implement the do while loop structure to allow the user to add ingredients until he or she is done.
Within your loop, add a branch control structure to prompt the user to enter an ingredient or indicate that he or she is finished.
Use a for loop to iterate through the ingredientList to print the ingredients in the list.
Starter code
package SteppingStones;
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import java.util.Scanner; import java.util.ArrayList;
public class SteppingStone4_Loops { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); String recipeName = ""; ArrayList
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