import java.util.*;
import static java.lang.System.*;
import java.util.Random;

public class Loops2 {
    public static void main (String[] args) {
        Scanner reader  = new Scanner ( System.in );
        int score1 = 0;
        int score2 = 0;
        int score3 = 0;
        double average = 0;

        int choice = 100;

        while (choice != -1) {
            System.out.println("1  |  Find an Average");
            System.out.println("2  |  My bowling score");
            System.out.println("3  |  Running low on Gasoline");
            System.out.println("4  |  Check if Equal");
            System.out.println("5  |  Check the largest");
            System.out.println("6  |  Power");
            System.out.println("7  |  Triple");
            System.out.println("8  |  Chemistry");
            System.out.println("9  |  University Acceptance");
            System.out.println("10 |  Number game");
            System.out.println("==================================");
            System.out.println("-1 |  Stop the loop");
            choice = reader.nextInt();

            switch (choice) {
                // AVERAGE
                case 1:
                    System.out.println("Enter 3 scores:    *");
                    score1 = reader.nextInt();
                    score2 = reader.nextInt();
                    average = findAverage(score1, score2, score3);
                    System.out.println("Your average: " + average);
                    break;

                // BOWLING SCORE
                case 2:
                    System.out.println("Enter your bowling score:    *");
                    int bowlingScore = reader.nextInt();
                    bowlingComment(bowlingScore);
                    break;

                // GALLONS
                case 3:
                    System.out.println("Enter the amount of gasoline you have (in gallons):    *");
                    int currentGallons = reader.nextInt();
                    isLow(currentGallons);
                    break;

                // EQUAL
                case 4:
                    System.out.println("Enter two values:    *");
                    double e_value1 = reader.nextDouble();
                    double e_value2 = reader.nextDouble();
                    System.out.println("Checking if they're equal..");

                    boolean e_result = areEqual(e_value1, e_value2);

                    if (e_result) {
                        System.out.println("true | Inputs are equal!");
                    } else {
                        System.out.println("false | Inputs are NOT equal!");
                    }

                    break;

                // LARGEST
                case 5:
                    System.out.println("Enter three values:    *");
                    int l_value1 = reader.nextInt();
                    int l_value2 = reader.nextInt();
                    int l_value3 = reader.nextInt();

                    largest(l_value1, l_value2, l_value3);

                    break;

                // POWEr
                case 6:
                    System.out.println("Enter a base value:    *");
                    int baseValue = reader.nextInt();

                    System.out.println("Enter an exponent value:    *");
                    int exp = reader.nextInt();

                    powerFunction(baseValue, exp);

                    break;

                case 7:
                    System.out.println("Enter three values:    *");
                    double t_value1 = reader.nextDouble();
                    double t_value2 = reader.nextDouble();
                    double t_value3 = reader.nextDouble();

                    boolean t_result = isTriple(t_value1, t_value2, t_value2);

                    if (t_result) {
                        System.out.println(t_result);
                    } else {
                        System.out.println(t_result);
                    }

                    break;

                // CHEMISTRY
                case 8:
                    System.out.println("Enter chemsitry level:    *");
                    int chemistry = reader.nextInt();

                    System.out.println("Are you in school?    *");
                    boolean inSchool = reader.nextBoolean();

                    secondDate(chemistry, inSchool);

                    break;

                // UNIVERSITY ACCEPTANCE
                case 9:
                    System.out.println("Enter your GPA:    *");
                    double getGPA = reader.nextDouble();

                    System.out.println("Are you related to Bill Gates?    *");
                    boolean withGates = reader.nextBoolean();

                    System.out.println("Are you with Darth Vader?    *");
                    boolean withVader = reader.nextBoolean();

                    System.out.println("isAccepted: " + isAccepted(getGPA, withGates, withVader));

                    break;

                case 10:
                    System.out.println("Numbers range from 1 - 10 | -1 to quit");

                    System.out.println("Enter your guess of a numeric (INT) value:    *");
                    int game_guess = reader.nextInt();

                    NumberGame(game_guess);

                    break;

                // EXIST
                case -1:
                    System.out.println("Goodbye!");

                    // EXIST 2
                default :
                    System.out.println("ERR: Invalid choice!");
            }

        }
    }  // end of main

    //********************************************************************     1
    public static double findAverage(int s1, int s2, int s3)  {
        return (s1 + s2 + s3) / 3.0;
    }
    //**************************************************************     2
// Prints a comment based on a bowling score
    public static void bowlingComment(int myScore) {
        if (myScore >= 300) {
            System.out.println("Perfection!");
        } else if (myScore > 230) {
            System.out.println("So Pro!");
        } else if (myScore > 150) {
            System.out.println("Decent!");
        } else if (myScore > 80) {
            System.out.println("Not Bad!");
        } else {
            System.out.println("Get Better!");
        }
    }
    //**************************************************************      3
//   Returns true if we are low on fuel-(less than 3 gallons), false otherwise
    public  static boolean isLow(  int myGallons  ) {
        if (myGallons < 3) {
            return true;
        } else {
            return false;
        }
    }
//**************************************************************    4

    // check if a and b are essentially equal- use the abs math function
    public  static boolean areEqual(double a, double b) {
        if (Math.abs(a - b) < 0.0001) {
            return true;
        } else {
            return false;
        }
    }
    //**************************************************************   5
// Return the largest of the three values
    public  static int largest(  int a, int  b, int c  ) {
        if (a >= b && a >= c) {
            return a;
        } else if (b >= a && b >= c) {
            return b;
        } else {
            return c;
        }
    }
    //**************************************************************  6
//Return the the value of b raised to the e power
    public  static double powerFunction( int b , int e  ) {
        double product = 1;

        for (int y = 1; y <= e; y++) {
            product = product * b;
        }

        return product;
    }
    //**************************************************************  7
// Return whether a^2 + b^2 == c^2, where c is larger than a and b
    public static boolean isTriple( double a, double b, double c ) {
        if ((a * a) + (b * b) == (c * c)) {
            return true;
        } else {
            return false;
        }
    }
    //**************************************************************   8
    /* Do we go on a second date with someone?
    The given chemistry is in the range 0..100 and
              isSchool is true if it is during the school year.
    The answer is Sure if chemistry is 60 or more, or
                40 or more in chemistry and not in the school year.
    */
    public  static  void secondDate( int chemistry, boolean isSchool ) {
        if (chemistry >= 60 || chemistry >= 40 && !isSchool) {
            System.out.println("Sure!");
        } else {
            System.out.println("No, my dog ate my homework.");
        }
    }

//************************************************************** 9
    /*Returns true if the person gets into Stanford.
    Given   gpa = 0...4.0,
    		isGates = child of Bill Gates,
    		isDarth = associated with Darth Vader.
    To get in: must not be associated with Darth Vader at all.
    	       Gpa must be over 3.95   Or  gpa over 1.0 if child of Bill Gates  */

    public  static boolean isAccepted(double gpa, boolean isGates, boolean isVader) {
        if (isVader) {
            return false;
        } else if (gpa > 3.95 || gpa > 1.0 && isGates) {
            return true;
        } else {
            return false;
        }
    }

    public static int NumberGame(int guess) { // Could've been made much much better lmaoo
        Random rand = new Random();

        if (guess == -1) {
            return guess;
        }

        int GetRandom = rand.nextInt(10) + 1;

        if (guess == GetRandom) {
            System.out.println("Congratulations! You won!");
        } else {
            System.out.println("Wrong! The number was actually " + GetRandom);
        }

        return guess;
    }
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: