samedi 3 octobre 2020

Boolean specific if-else statements looping until true

I'm working on a project and I have to use if-else statements and loops. I'm still very new to Java and I hope that my train of thought makes sense. I know it's full of errors, I want feedback on 1) if it's possible and 2) if so, what is the best way to utilize the boolean and if-else statements in this project for a neater more understandable code?

My train of thought is:

import java.util.Scanner;

public class InterestCalculator {
    public static void main (String [] args) {
        Scanner scnr = new Scanner(System.in);

        int numQuarters;
        double begPrinBalance;
        double interestRate;
        boolean yn;

        boolean yn == true;
        
        if (boolean == true){
            //code
        }
        else ( boolean != true){
            while (){
                while(){
                    //loop until true
                }
            }
        }
    }
}

Aucun commentaire:

Enregistrer un commentaire