How to end a while Loop via user input

前端 未结 5 368
深忆病人
深忆病人 2021-01-22 18:42
package cst150zzhw4_worst;

import java.util.Scanner;

public class CST150zzHW4_worst {

    public static void main(String[] args) {
    //Initialize Variables
    doub         


        
5条回答
  •  -上瘾入骨i
    2021-01-22 19:13

    You have to assign repeat in your while-loop so it becomes false if the user says yes:

    repeat = !input.equalsIgnoreCase("yes"); 
    

提交回复
热议问题