Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
d6a059c
Updated basic operator methods and Main Application
Oct 20, 2019
6528faa
Updated basic operator methods and Main Application
Oct 20, 2019
9d22f71
Updated Mainapp, BasicCalc, and MemoryAndSettings
Oct 20, 2019
addf10b
Updated Mainapp, BasicCalc, and MemoryAndSettings
Oct 20, 2019
b8812d9
Updated Mainapp, BasicCalc, and MemoryAndSettings
Oct 20, 2019
c104849
Updated Mainapp, BasicCalc, and MemoryAndSettings
Oct 20, 2019
b72e967
Updated Mainapp, BasicCalc, and MemoryAndSettings
Oct 20, 2019
ab6999b
Update
Oct 20, 2019
29e64b0
Update
Oct 20, 2019
72be463
added methods
valfragier16 Oct 20, 2019
0949963
updated
valfragier16 Oct 20, 2019
e85feab
Update
Oct 20, 2019
1b01efb
Update
Oct 20, 2019
9743019
updated methods
valfragier16 Oct 20, 2019
1806d6c
made corrections
valfragier16 Oct 20, 2019
64ae84d
Updated Basic Calc Tests
aash-bjw Oct 20, 2019
01b5550
Update
Oct 20, 2019
7f68181
Merge branch 'master' of https://github.com/valfragier16/ScientificCa…
aash-bjw Oct 20, 2019
8f3a5b5
updated prompts for sci methods
valfragier16 Oct 20, 2019
b078e47
cleaned up sci mecalc
valfragier16 Oct 20, 2019
8e3d629
Update
Oct 20, 2019
cc07274
Merge branch 'master' of github.com:valfragier16/ScientificCalculator…
Oct 20, 2019
11b2861
Merge branch 'master' of github.com:valfragier16/ScientificCalculator…
Oct 20, 2019
1bb6d7d
Dropped in SciCalc tests - need to input expected #
aash-bjw Oct 20, 2019
8986bc5
deleted Console.getDoubleInput
valfragier16 Oct 20, 2019
a3ec865
Basic Calc Tests all passing
aash-bjw Oct 20, 2019
a76cab9
Merge branch 'master' of https://github.com/valfragier16/ScientificCa…
aash-bjw Oct 20, 2019
9b98b3d
fixed if conditions
valfragier16 Oct 20, 2019
7f95881
deleted ifs
valfragier16 Oct 20, 2019
5077948
updated
valfragier16 Oct 20, 2019
ecd218c
Update
Oct 20, 2019
5f5ca78
Merge branch 'master' of github.com:valfragier16/ScientificCalculator…
Oct 20, 2019
afa6f4c
Update
Oct 20, 2019
8415cb4
All tests passing except inverse trig
aash-bjw Oct 20, 2019
757f828
Update
Oct 20, 2019
0464e9d
Merge branch 'master' of github.com:valfragier16/ScientificCalculator…
Oct 20, 2019
a24c276
fix bugs
valfragier16 Oct 21, 2019
8642346
added exp and log methods
valfragier16 Oct 21, 2019
f4eb355
All Tests passing
aash-bjw Oct 21, 2019
0676a38
Log & Exponent tests included but failing
aash-bjw Oct 21, 2019
7036ee4
updated exponent
valfragier16 Oct 21, 2019
b696783
Update
Oct 21, 2019
16bd557
Merge branch 'master' of github.com:valfragier16/ScientificCalculator…
Oct 21, 2019
94e28d1
Update
Oct 21, 2019
9225345
add log
valfragier16 Oct 21, 2019
0f10150
added logs
valfragier16 Oct 21, 2019
1733044
Update
Oct 21, 2019
f09cf88
Update
Oct 21, 2019
8f8cd07
updated logs
valfragier16 Oct 21, 2019
164bbe0
updated logs
valfragier16 Oct 21, 2019
54b126c
Update
Oct 21, 2019
09be2ad
Merge branch 'master' of github.com:valfragier16/ScientificCalculator…
Oct 21, 2019
bb17d55
Update
Oct 21, 2019
d6fcb5a
Update
Oct 21, 2019
7a99e8f
Update
Oct 21, 2019
f835a63
Added Log Tests
aash-bjw Oct 21, 2019
d14f406
Update
Oct 21, 2019
7c10909
Add binary, octal, decimal, hexadecimal
valfragier16 Oct 21, 2019
6cccd57
Update
Oct 21, 2019
2d696ce
Add conversions from string to integer
valfragier16 Oct 21, 2019
1399209
Update
Oct 21, 2019
e0ed48d
Merge branch 'master' of github.com:valfragier16/ScientificCalculator…
Oct 21, 2019
b476265
ConversionCalcTests all pass
aash-bjw Oct 21, 2019
0a0dc57
Merge branch 'master' of https://github.com/valfragier16/ScientificCa…
aash-bjw Oct 21, 2019
8767580
Update
Oct 21, 2019
bcbd538
Merge branch 'master' of github.com:valfragier16/ScientificCalculator…
Oct 21, 2019
9588009
Update
Oct 21, 2019
ac1db0f
Update
Oct 21, 2019
6d7d059
Add switch for conversion
valfragier16 Oct 21, 2019
3f9a640
Update
Oct 21, 2019
7c96b47
Merge branch 'master' of github.com:valfragier16/ScientificCalculator…
Oct 21, 2019
3bb6c55
Replacement
MikeGray31 Oct 21, 2019
54743d1
Add files via upload
MikeGray31 Oct 21, 2019
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
Binary file added .DS_Store
Binary file not shown.
Binary file added CalculatorUML.pdf
Binary file not shown.
26 changes: 26 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,32 @@
<groupId>com.zipcodewilmington</groupId>
<artifactId>scientific_calculator</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>7</source>
<target>7</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>


</project>
Binary file added src/.DS_Store
Binary file not shown.
Binary file added src/main/.DS_Store
Binary file not shown.
Binary file added src/main/java/.DS_Store
Binary file not shown.
Binary file added src/main/java/com/.DS_Store
Binary file not shown.
Binary file added src/main/java/com/zipcodewilmington/.DS_Store
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
package com.zipcodewilmington.scientificcalculator;

public class BasicCalculator {

//fields for storing results
private Double doubleResult;
private String stringResult;

//initializing an error class
Error error = new Error();

//Constructor
public BasicCalculator(){
doubleResult = null;
stringResult = "0";
}

//Basic Operator functions
public void add(Double x, Double y){
try {

this.setDoubleResult(x + y);
this.setStringResult(Double.toString(x + y));
}

//for non-double inputs
catch(Exception e){
this.setDoubleResult(null);
this.setStringResult("ERROR");
}
}

public void subtract(Double x, Double y){
try {
this.setDoubleResult(x - y);
this.setStringResult(Double.toString(x - y));

}
//for non double inputs
catch(Exception e){
this.setDoubleResult(null);
this.setStringResult("ERROR");
}
}

public void multiply(Double x, Double y){
try {
this.setDoubleResult(x * y);
this.setStringResult(Double.toString(x * y));

}
//for non double inputs
catch(Exception e){
this.setDoubleResult(null);
this.setStringResult("ERROR");
}
}

public void divide(Double x, Double y){
try {
if (error.IsBadValue(x, 0.0)){
this.setDoubleResult(null);
this.setStringResult("ERROR");
}
else {
this.setDoubleResult(x / y);
this.setStringResult(Double.toString(x / y));
}
}
//for non double inputs.
catch(Exception e){
this.setDoubleResult(null);
this.setStringResult("ERROR");
}
}


//Getters and Setters for class fields

public double getDoubleResult() {
return doubleResult;
}

public void setDoubleResult(Double doubleResult) {
double number = (Math.round(doubleResult * 1000.0))/1000.0;
this.doubleResult = number;
}

public String getStringResult() {
return stringResult;
}

public void setStringResult(String stringResult) {
this.stringResult = stringResult;
}



}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
*/
public class Console {

public void updatedisplay(){

}

public static void print(String output, Object... args) {
System.out.printf(output, args);
}
Expand All @@ -17,16 +21,22 @@ public static void println(String output, Object... args) {

public static String getStringInput(String prompt) {
Scanner scanner = new Scanner(System.in);
println(prompt);
print(prompt);
String userInput = scanner.nextLine();
return userInput;
}

public static Integer getIntegerInput(String prompt) {
return null;
Scanner scanner = new Scanner(System.in);
print(prompt);
Integer userInput = Integer.valueOf(scanner.nextLine());
return userInput;
}

public static Double getDoubleInput(String prompt) {
return null;
Scanner scanner = new Scanner(System.in);
print(prompt);
Double userInput = Double.valueOf(scanner.nextLine());
return userInput;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
package com.zipcodewilmington.scientificcalculator;

//import com.sun.jdi.connect.Connector;

public class ConversionCalculator {

//fields for storing results
private Double doubleResult;
private String stringResult;

//Constructor
public ConversionCalculator(){
doubleResult = 0.0;
stringResult = "0";
}

//Scientific Operator Conversion functions
//(binary, octal, decimal, hexadecimal)
public void binary(int x){
try {
this.setStringResult(Integer.toBinaryString(x));
}

//for non-double inputs
catch(Exception e){
this.setDoubleResult((double) 0);
this.setStringResult("ERROR");
}
}

public void binaryToInt(String x){
try {
Integer y = Integer.parseInt(x,2);

this.setStringResult(y.toString());
}

//for non-double inputs
catch(Exception e){
this.setDoubleResult((double) 0);
this.setStringResult("ERROR");
}
}

public void octal(int x){
try {

//this.setDoubleResult(Math.pow(x));
this.setStringResult(Integer.toOctalString(x));
}

//for non-double inputs
catch(Exception e){
this.setDoubleResult((double) 0);
this.setStringResult("ERROR");
}
}

public void octalToInt(String x){
try {
Integer y = Integer.parseInt(x,8);

this.setStringResult(y.toString());
}

//for non-double inputs
catch(Exception e){
this.setDoubleResult((double) 0);
this.setStringResult("ERROR");
}
}

public void decimal(int x){
try {

double y = x;
this.setDoubleResult(y);
this.setStringResult(Double.toString(y));
}

//for non-double inputs
catch(Exception e){
this.setDoubleResult((double) 0);
this.setStringResult("ERROR");
}
}

public void hexadecimal(int x){
try {

this.setStringResult(Integer.toHexString(x));
}

//for non-double inputs
catch(Exception e){
this.setDoubleResult((double) 0);
this.setStringResult("ERROR");
}
}

public void hexadecimalToInt(String x){
try {
Integer y = Integer.parseInt(x,16);

this.setStringResult(y.toString());
}

//for non-double inputs
catch(Exception e){
this.setDoubleResult((double) 0);
this.setStringResult("ERROR");
}
}





//Getters and Setters for class fields

public double getDoubleResult() {
return doubleResult;
}

public void setDoubleResult(Double doubleResult) {
double number = (Math.round(doubleResult * 1000.0))/1000.0;
this.doubleResult = number;
}

public String getStringResult() {
return stringResult;
}

public void setStringResult(String stringResult) {
this.stringResult = stringResult;
}



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

public class Error {

//these methods checks an input value against a series of possible
//values which could cause an error.

public boolean IssBadValue(Double input, Double[] not_this){

for (int i = 0 ;i < not_this.length;i++) {

if (input == not_this[i]) {
return true;
}
}
return false;
}

public boolean IsBadValue(Double input, Double not_this){

if (input == not_this) {
return true;
}
else {
return false;
}
}

public boolean checkForBadTrigValues(Double input, Double not_this){ //not_this MUST be a positive value
while(input < -not_this){
input += (2 * not_this);
}
while(input > not_this){
input -= (2 * not_this);
}
if(input == not_this || input == -not_this){
return true;
}
else {
return false;
}
}

public boolean checkForOutsideRange(Double input, Double lowerlimit, Double higherlimit){
if(input < lowerlimit || input > higherlimit){
return true;
}
return false;
}
}
Loading