Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hello, everyone. I\'m trying to make a Java program that allows a user to repeat

ID: 3624686 • Letter: H

Question

Hello, everyone.
I'm trying to make a Java program that allows a user to repeat an automated process where customers in a bank are brought up through a queue to one of five tellers whenever the tellers are available. If the user chooses to repeat the execution, the aforementioned process will run; if he/she chooses not to repeat the execution, the program will terminate. Right now, I'm using a basic "yes/no" option to prompt the used if he/she wants to repeat the process.

The main problem I'm having now, however, is figuring out how I will repeat the yes/no prompt.

Explanation / Answer

//this program demonstrates how to run a block of operations repeatedly

//i am giving an example

import java.io.*;

public class NewMain {

     public static void main(String[] args) throws IOException

    {

    String choice;

                BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

                do//to execute block repeatedly until user says no

                {

                //Place Your Code Here

                //ask user to enter choice

                System.out.println("Enter Your Choice");

                choice=br.readLine();

                if(!choice.equalsIgnoreCase("yes")&&!choice.equalsIgnoreCase("no"))

    {

        System.out.println("Sorry yes and no are only the acceptable answers try again");

        continue;

    }

                }while(!choice.equalsIgnoreCase("no"));

    }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote