/Assignment-2

Code downloaded from a private repo: https://github.com/IComplainInComments/Assignment-2 -- and made public for personal use, at the consent of the other developers.

Primary LanguageJavaGNU General Public License v3.0GPL-3.0

Assignment-2 Opening Comment

Program Title:

  • Assignment-2

Source files:

  • Main.java
  • Inputs.java
  • FermatMiss.java
  • PowMath.java

Requires files:

  • N/A

Creates files:

  • N/A

Programmer Names & Emails:

Course:

  • Software Engineering - COSC 445W - Spring 2021

Start Date:

  • 2/15/2021

Submit Date:

  • 3/7/2021

Resources Used:

Explanation

  • This program first reads in two integer values, n and k, from the user, one at a time.
    • The acceptable range of n values is in the range (2, 12) / [3, 11].
    • The minimum acceptable k value is 10.
    • The maximum acceptable k is calculated based on the n value (in order to prevent any overflow or rounding errors).
  • Then, it iterates over all x, y pairs in the range [10, k].
  • For each pair, it calculates up to two z values such that z^n is as close to (x^n + y^n) as possible.
    • These are calculated by the floor and ceil of the nth root of (x^n + y^n).
  • It then creates FermatMiss objects with arguments (x, y, z, n).
  • All the while, it keeps track of the Minimum FermatMiss, and for each new one it finds, it outputs it to the console.
    • Since addition is commutative, if x and y are not the same, it will output both possible permutations for (x^n + y^n).
  • At the end, it awaits user-input before terminating.

RUNNING THE PROGRAM

  • Make sure you are running the latest version of Java.
  • On Windows, open Command Prompt and use the "cd" command to navigate to the directory where you have Assignment-2.jar installed.
  • Once you have accessed the correct directory, run the command "java -jar Assignment-2.jar".