/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.calebfontenot.lab7_calebfontenot;

import java.util.Scanner;

/**
 *
 * @author caleb
 */
public class DivisionQuiz {

    public static void main(String[] args)
    {
        // Create scanner
        Scanner input = new Scanner(System.in);
        // Setup variables
        int number1,
                number2,
                answerQuotient,
                answerRemainder;
        boolean cheatMode = false; // Used for debugging

        while (true) {
            // Get random numbers between 1-100
            number1 = (int) (Math.random() * 100);
            number2 = (int) (Math.random() * 100);

            // If number1 < number2, flip them
            if (number1 < number2) {
                int tmp = number2;
                number2 = number1;
                number1 = tmp;
            }

            //Prompt
            if (cheatMode == true) {
                System.out.println("CHEAT MODE: the quotient of " + number1 + " / " + number2 + " is " + (number1 / number2));
            }
            System.out.print(" What is the quotient of " + number1 + " / " + number2 + "? ");
            answerQuotient = input.nextInt();
            if (cheatMode == true) {
                System.out.println("CHEAT MODE: the remainder of " + number1 + " % " + number2 + " is " + (number1 % number2));
            }
            System.out.print(" What is the remainder of " + number1 + " / " + number2 + "? ");
            answerRemainder = input.nextInt();

            // Check if answers are correct
            if ((number1 / number2) == answerQuotient) //Checks the quotient
            {
                System.out.println("You are correct about the quotient!");
            } else {
                System.out.println("You are wrong about the quotient.");
                System.out.println("The quotient of " + number1 + " / " + number2 + " is " + (number1 / number2));
            }
            if ((number1 % number2) == answerRemainder) //Checks the remainder
            {
                System.out.println("You are correct about the remainder!");
            } else {
                System.out.println("You are wrong about the remainder.");
                System.out.println("The remainder of " + number1 + " % " + number2 + " is " + (number1 % number2));
            }
        }
    }
}
