Skip to content

pull request #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 64 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
b181a67
Added 1 Sum test.
JeremySabina Jun 27, 2021
8837f22
Connected with Main Application and Console
JeremySabina Jun 27, 2021
fd36d98
It Works
JeremySabina Jun 27, 2021
2f024f1
Added Subtraction with test cases <Incomplete>
JeremySabina Jun 27, 2021
3bf3e26
Worked on switch statement <Incomplete>
JeremySabina Jun 27, 2021
3f110d2
Added the start of switch.
charnaexw Jun 27, 2021
67032e4
Merge pull request #1 from charnaexw/master
charnaexw Jun 27, 2021
a8b9bc0
Tried to fix the switch statement in the Main application.
JeremySabina Jun 27, 2021
890ec4e
Worked on switch statement.
JeremySabina Jun 27, 2021
d86c99d
Added COS SIN TAN + inverse
charnaexw Jun 27, 2021
322ed80
Added another switch(sqrt, sq, factorial, cubed)
charnaexw Jun 27, 2021
103cd7e
Adding the MR MC M-
charnaexw Jun 27, 2021
2b8319e
ignore the red.
charnaexw Jun 27, 2021
3da4d22
Testing branches
JeremySabina Jun 27, 2021
1139866
Making Chnages.
charnaexw Jun 27, 2021
009177c
Merge branch 'master' into master
JeremySabina Jun 27, 2021
42020a1
the struggle
Bobbi-Z Jun 27, 2021
6efee4c
Merge remote-tracking branch 'origin/master'
Bobbi-Z Jun 27, 2021
013a00d
the struggle is real
Bobbi-Z Jun 27, 2021
a187e13
Merge pull request #2 from charnaexw/master
JeremySabina Jun 27, 2021
4af3d2a
.log maybe
charnaexw Jun 27, 2021
a3d897a
Added Basic Arithmatic test cases
JeremySabina Jun 28, 2021
32a1e29
added Radians.
charnaexw Jun 28, 2021
26f8601
Merge pull request #4 from charnaexw/master
JeremySabina Jun 28, 2021
301d738
Merge branch 'master' into master
Bobbi-Z Jun 28, 2021
4566f5d
Merge pull request #3 from Bobbi-Z/master
Bobbi-Z Jun 28, 2021
92b065e
This is what we have for science.
charnaexw Jun 28, 2021
91eb470
Fixed up some of the display.
JeremySabina Jun 28, 2021
7882cfa
again.
charnaexw Jun 28, 2021
836ac70
Merge branch 'master' into master
charnaexw Jun 28, 2021
b8fc513
Merge pull request #5 from charnaexw/master
charnaexw Jun 28, 2021
035f89a
Merge pull request #1 from Professional-Coding-Developments/master
charnaexw Jun 28, 2021
c9f0b6c
square root
Bobbi-Z Jun 28, 2021
9b9dc25
square root test
Bobbi-Z Jun 28, 2021
e7307cf
square root test
Bobbi-Z Jun 28, 2021
c70a2ac
square root test2
Bobbi-Z Jun 28, 2021
ba0e062
Added some more things to the display.
JeremySabina Jun 28, 2021
fe1be29
Merge branch 'master' of https://github.com/Professional-Coding-Devel…
JeremySabina Jun 28, 2021
31183ba
Merge remote-tracking branch 'origin/master'
Bobbi-Z Jun 28, 2021
03f3aac
I greyed out a lot of code but the code that is there should now be c…
charnaexw Jun 28, 2021
9bdb4e0
Merge pull request #6 from charnaexw/master
charnaexw Jun 28, 2021
8d6131c
Added some basic calculator and scientific functionality.
JeremySabina Jun 28, 2021
e182dba
Merge branch 'master' of https://github.com/Professional-Coding-Devel…
JeremySabina Jun 28, 2021
60531d5
fixing tests
Bobbi-Z Jun 28, 2021
d39280c
I'm sleepy.
charnaexw Jun 28, 2021
42e7a08
root and square - all tests pass
Bobbi-Z Jun 28, 2021
28fcabe
Add files via upload
Bobbi-Z Jun 28, 2021
21c0fca
Merge branch 'Professional-Coding-Developments:master' into master
Bobbi-Z Jun 28, 2021
7023e24
Delete TestMainApplication.java
Bobbi-Z Jun 28, 2021
9113a1a
Delete CalculatorEngineTest.java
Bobbi-Z Jun 28, 2021
bd48d04
Merge remote-tracking branch 'origin/master'
Bobbi-Z Jun 28, 2021
7d29c67
double check all code
Bobbi-Z Jun 28, 2021
f823789
Merge pull request #8 from Bobbi-Z/master
Bobbi-Z Jun 28, 2021
7dad93f
Add files via upload
Bobbi-Z Jun 28, 2021
5dd441e
Add files via upload
Bobbi-Z Jun 28, 2021
bb4b97e
Merge pull request #9 from Bobbi-Z/master
Bobbi-Z Jun 28, 2021
030d5ed
all my tests pass
charnaexw Jun 28, 2021
7c53258
Merge pull request #10 from charnaexw/master
charnaexw Jun 28, 2021
f74c1f3
added static to the class in my code.
charnaexw Jun 28, 2021
a239c87
Merge pull request #11 from charnaexw/master
charnaexw Jun 28, 2021
30c242d
Add files via upload
Bobbi-Z Jun 28, 2021
e7fd8fe
Merge pull request #12 from Bobbi-Z/master
Bobbi-Z Jun 28, 2021
831537d
last minute updates
Bobbi-Z Jun 28, 2021
600e015
Merge pull request #13 from Bobbi-Z/master
Bobbi-Z Jun 28, 2021
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.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

## Description

In this project your team will build a small app to function as a calculator. This app will be built in Java, and will use the topics and techniques discussed during the week.
In this project your team will build a small app to function as a calculatorEngine. This app will be built in Java, and will use the topics and techniques discussed during the week.

Your team should work on this project in a single repository. Click the `fork` button in the top right corner to create a copy of this repository in one of your github accounts. You can go through the [GitHub forking tutorial](https://help.github.com/articles/fork-a-repo/) if you need additional practice with this.

Expand All @@ -23,7 +23,7 @@ You must produce UML diagrams for your program. All classes (excluding test clas

All calculators should have the following features:

- A state, representing the value currently displayed on the calculator (default 0) *
- A state, representing the value currently displayed on the calculatorEngine (default 0) *
- Get the current number on the display *
- Clear the display *
- Change the number on the display *
Expand Down Expand Up @@ -67,7 +67,7 @@ Each operation should automatically update the display

### Custom Features

In addition to the Core and Scientific features, you are required to create at least two of your own features for the calculator. They can be any two features that are not already covered and that you can implement as you see fit. These features must be properly tested.
In addition to the Core and Scientific features, you are required to create at least two of your own features for the calculatorEngine. They can be any two features that are not already covered and that you can implement as you see fit. These features must be properly tested.

### Hints

Expand Down
Binary file added Scientific-Calc UML.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,26 @@
<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>
</dependencies>


</project>
3 changes: 3 additions & 0 deletions src/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions src/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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

public class Calculator {

private static int result;

public static int sum(int firstNum, int secondNum) {
result = firstNum + secondNum;
return result;
}

public int subtract(int firstNum, int secondNum) {
result = firstNum - secondNum;
return result;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.zipcodewilmington.scientificcalculator;

public class CalculatorDisplay {

public static void menuOption1() {
String prompt;
outerLoop:
do {
prompt = Console.getStringInput("");
switch (prompt.toLowerCase()) {
case "1":
System.out.println("Here are some Basic Functions. \n(+) - Addition \n(-) - Subtraction \n(/) - Division \n(*) - Multiplication");
break;
case "2":
System.out.println("Here are some Scientific Functions. \nSine() \nCosine() \nTangent()");
break;
case "3":
String userInput = Console.getStringInput("Time for some math? \n ( Y / N )");
if (userInput.equalsIgnoreCase("Y")) {
break outerLoop;
}
break;
default:
Console.println("[ %s ] is not a valid input!", prompt);
break;
}
} while (true);
}
public static void basicOperators(){

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

public class CalculatorEngine {
// CalculatorEngine calculatorEngine = new CalculatorEngine();
private static Double value;

public static Double sum(Double firstNum, Double secondNum) {
return firstNum + secondNum;
}

public static Double subtract(Double firstNum, Double secondNum) {
return firstNum - secondNum;
}

public static Double divide(Double firstNum, Double secondNum) {
return firstNum / secondNum;
}

public static Double multiply(Double firstNum, Double secondNum) {
return firstNum * secondNum;
}

public static Double squareRoot(Double firstNum){
double s;
double value = firstNum / 2;
do {
s = value;
value = (s +(firstNum / s)) / 2;
}
while ((s - value) != 0);
return value;
}

public static Double square(Double firstNum){
return firstNum * firstNum;
}

public static Double squareY(Double firstNum, Double secondNum) {
return Math.pow(firstNum, secondNum);

}

public static Double squareRootY(Double firstNum, Double secondNum){
double xPre = Math.random() % 10;
double eps = 0.001;
double delX = 2147483647;
double xK = 0.00;
double A = firstNum;
double N = secondNum;


while (delX > eps){
xK = ((N - 1.0) * xPre + A / Math.pow(xPre, N - 1)) / N;
delX = Math.abs(xK - xPre);
xPre = xK;
}
double value = Math.round(xK * 1000.00) / 1000.00;
return value;
}

public static Double inverse(Double firstNum){
return 1 / firstNum;
}

public static Double signSwitch(Double firstNum){
return firstNum * (-1);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ public class Console {
public static void print(String output, Object... args) {
System.out.printf(output, args);
}

public static void println(String output, Object... args) {
print(output + "\n", args);
}
Expand All @@ -23,10 +22,16 @@ public static String getStringInput(String prompt) {
}

public static Integer getIntegerInput(String prompt) {
return null;
Scanner scanner = new Scanner(System.in);
System.out.println(prompt);
Integer userInput = scanner.nextInt();
return userInput;
}

public static Double getDoubleInput(String prompt) {
return null;
Scanner scanner = new Scanner(System.in);
System.out.println(prompt);
Double userInput = scanner.nextDouble();
return userInput;
}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,72 @@
package com.zipcodewilmington.scientificcalculator;
import java.util.Scanner;

/**
* Created by leon on 2/9/18.
*/
public class MainApplication {
public static void main(String[] args) {
Console.println("Welcome to my calculator!");
String s = Console.getStringInput("Enter a string");
Integer i = Console.getIntegerInput("Enter an integer");
Double d = Console.getDoubleInput("Enter a double.");

Console.println("The user input %s as a string", s);
Console.println("The user input %s as a integer", i);
Console.println("The user input %s as a d", d);

private CalculatorEngine engine = new CalculatorEngine();
private CalculatorDisplay display = new CalculatorDisplay();

public static void main(String[] args) {
System.out.println("Welcome! \nTake a look at some of our functions!");
System.out.println("(1) Basic Functions \n(2) Scientific Functions \n(3) Math time!");
CalculatorDisplay.menuOption1();

System.out.println("Please choose an operator ( +, - , / , * )");
String operator = Console.getStringInput("");
Console.println("You entered %s\n", operator);
System.out.println("Enter your first number");
Double firstNum = Console.getDoubleInput("");
Console.println("%s", firstNum);
System.out.println("Enter your second number");
Double secondNum = Console.getDoubleInput("");
Console.println("%s", secondNum);

String basicMathOperator = operator;

switch (basicMathOperator) {
case "+":
System.out.println(CalculatorEngine.sum(firstNum, secondNum));
break;
case "-":
System.out.println();
CalculatorEngine.subtract(firstNum, secondNum);
break;
case "/":
System.out.println(CalculatorEngine.divide(firstNum, secondNum));
break;
case "*":
System.out.println(CalculatorEngine.multiply(firstNum, secondNum));
break;
default:
System.out.println("Unable to do math.");
}

String scientificOperator = operator;
switch (scientificOperator) {
case "cos":
System.out.println(Math.cos(firstNum));
break;
case "tan":
System.out.println(Math.sin(firstNum));
break;
case "sin":
System.out.println(Math.tan(firstNum));
break;
default:
System.out.println("Unable to do math.");
}
}
}

/*
String s = Console.getStringInput("Enter a string");
Integer i = Console.getIntegerInput("Enter an integer");
Double d = Console.getDoubleInput("Enter a double.");
Console.println("The user input %s as a string", s);
Console.println("The user input %s as a integer", i);
Console.println("The user input %s as a double", d);
*/

Loading