Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
1aa7d50
Accidentaly made this edits in master branch: Added Arthmetic class w…
PhoenixJai Jul 11, 2026
abb684a
Add multi-page scientific calculator menu
mattgregory89-bot Jul 11, 2026
f4485c5
fixed git merge conflicts on my branches
PhoenixJai Jul 11, 2026
4f1b5dd
Merge remote-tracking branch 'origin/master' into jaiden-branch
PhoenixJai Jul 11, 2026
8973359
Glued logic and I/0 for cases 1-4. Cases have been tested are functio…
PhoenixJai Jul 11, 2026
c17d8c5
Merge pull request #1 from mattgregory89-bot/jaiden-branch
PhoenixJai Jul 11, 2026
778fa97
cases 5 -7 have been glued
PhoenixJai Jul 12, 2026
26428f9
cmmenting to pull correctly
PhoenixJai Jul 12, 2026
3edcbc5
Merge pull request #2 from mattgregory89-bot/jaiden-branch
PhoenixJai Jul 12, 2026
f3c32bf
Sine, Cosine, and Tangent have been glued
PhoenixJai Jul 12, 2026
07e1a77
Trying to push S/CS/Tan again
PhoenixJai Jul 12, 2026
5cd3191
trig cases 3-6 have been glued
PhoenixJai Jul 12, 2026
91a3aec
Merge pull request #3 from mattgregory89-bot/jaiden-branch
PhoenixJai Jul 12, 2026
26ddd57
added PageResult class
PhoenixJai Jul 13, 2026
b0a188b
added pageresult method
PhoenixJai Jul 13, 2026
ae9dde6
added Degree/Radian conversion
PhoenixJai Jul 13, 2026
e48dc62
Merge pull request #4 from mattgregory89-bot/jaiden-branch
PhoenixJai Jul 13, 2026
fdbeb3e
Completed calculator menus and display functionality
mattgregory89-bot Jul 13, 2026
0526fda
Merge branch 'master' into matt-branch
PhoenixJai Jul 13, 2026
16dbb5e
Merge pull request #6 from mattgregory89-bot/matt-branch
PhoenixJai Jul 13, 2026
4f362f1
added secret feature again
PhoenixJai Jul 13, 2026
86482ff
Added secret feature2
mattgregory89-bot Jul 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
package com.zipcodewilmington.scientificcalculator;
public class Arithmetic {

//fields
private double result;

//constructor
//Sets the starting value for the calculation.
public Arithmetic(double initialValue) {
this.result = initialValue;
}

//methods

//addtion
public Arithmetic add(double num) {
this.result = this.result + num;
return this; // returns the object itself, enabling chaining like add(5).multiply(2)
}

//subtraction
public Arithmetic subtract(double num) {
this.result = this.result - num;
return this;
}

//multiplication
public Arithmetic multiply(double num) {
this.result = this.result * num;
return this;
}

//division
public Arithmetic divide(double num) {
if (num == 0) {
throw new ArithmeticException("Denominator cannot be zero");
}
this.result = this.result / num;
return this;
}

//square root, tehcnically redunant but it's functional.

public Arithmetic squareRoot(double num) {
this.result = Math.sqrt(num);
return this;
}


//power
public Arithmetic power(double num) {
this.result = Math.pow(this.result, num);
return this;
}

//modulo
public Arithmetic modulo(double num) {
this.result = this.result % num;
return this;
}

public Arithmetic sine() {
this.result = Math.sin(this.result);
return this;

}

public Arithmetic cosine() {
this.result = Math.cos(this.result);
return this;

}

public Arithmetic tangent() {
this.result = Math.tan(this.result);
return this;

}

public Arithmetic cosecant() {
this.result = (1/(Math.sin(this.result)));
return this;

}

public Arithmetic secant() {
this.result = (1/(Math.cos(this.result)));
return this;
}

public Arithmetic cotangent() {
this.result = (1/(Math.tan(this.result)));
return this;
}



//getResult() - will retrieve the final value after chaining
public double getResult() {
return this.result;
}

}




Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package com.zipcodewilmington.scientificcalculator;

public class Calculator {

private double currentValue;
private double memory;

public Calculator() {
this.currentValue = 0;
this.memory = 0;
}

public void setCurrentValue(double currentValue) {
this.currentValue = currentValue;
}

public double getCurrentValue() {
return currentValue;
}

public void memoryStore() {
memory = currentValue;
}

public double memoryRecall() {
currentValue = memory;
return currentValue;
}

public void memoryAdd() {
memory = memory + currentValue;
}

public void memoryReset() {
memory = 0;
}

public double getMemory() {
return memory;
}

public String displayBinary() {
int wholeNumber = (int) currentValue;
return Integer.toBinaryString(wholeNumber);
}

public String displayOctal() {
int wholeNumber = (int) currentValue;
return Integer.toOctalString(wholeNumber);
}

public String displayDecimal() {
return String.valueOf(currentValue);
}

public String displayHexadecimal() {
int wholeNumber = (int) currentValue;
return Integer.toHexString(wholeNumber).toUpperCase();
}
}
Original file line number Diff line number Diff line change
@@ -1,32 +1,97 @@
package com.zipcodewilmington.scientificcalculator;

import java.util.InputMismatchException;
import java.util.Scanner;

/**
* Created by leon on 2/9/18.
*/
public class Console {

// Prints the given output without a newline character
public static void print(String output, Object... args) {
System.out.printf(output, args);
}

// Prints the given output followed by a newline character
public static void println(String output, Object... args) {
print(output + "\n", args);
}

// Gets a string input from the user
public static String getStringInput(String prompt) {
Scanner scanner = new Scanner(System.in);
println(prompt);
String userInput = scanner.nextLine();
return userInput;
}

// Gets an integer input from the user
// TODO: implement using scanner + Integer.parseInt (handle NumberFormatException)
public static Integer getIntegerInput(String prompt) {
return null;
// return null;

Scanner scanner = new Scanner(System.in);
println(prompt);

try {
Integer userInput = scanner.nextInt();
scanner.nextLine();
return userInput;

} catch (InputMismatchException e) {
scanner.nextLine();
println("Invalid input. Please enter a valid number");
return getIntegerInput(prompt);
}
}

// Gets a double input from the user
public static Double getDoubleInput(String prompt) {
return null;
// return null;
Scanner scanner = new Scanner(System.in); //this initalize input from the user.
println(prompt); //this prints the prompt to the console

try {
Double userInput = scanner.nextDouble(); //this gets the user's input as a double
scanner.nextLine(); // consume the newline character
return userInput;
} catch (InputMismatchException e) {
scanner.nextLine();
println("Invalid input. Please enter a valid number.");
return getDoubleInput(prompt);
}

}

// //Calculations: Can't use this anymore because it's stateless :( back to the drawing board - Jaiden)
// public static Double getCalc(Double num1, Double num2) {
// double result = 0;
// int operation = 0;

// switch (operation) {
// case 1:
// //addition
// result = num1 + num2;
// break;
// case 2:
// //subtraction
// result = num1 - num2;
// break;
// case 3:
// //multiplication
// result = num1 * num2;
// break;
// case 4:
// //division
// result = num1 / num2;
// break;
// default:
// System.out.println("Invalid operation");
// }

// return result;
// }


}
Loading