Skip to content

Commit c0bec1d

Browse files
committed
Initial commit
0 parents  commit c0bec1d

File tree

6 files changed

+313
-0
lines changed

6 files changed

+313
-0
lines changed

.gitignore

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
2+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
3+
4+
# User-specific stuff:
5+
.idea/**/workspace.xml
6+
.idea/**/tasks.xml
7+
.idea/dictionaries
8+
9+
# Sensitive or high-churn files:
10+
.idea/**/dataSources/
11+
.idea/**/dataSources.ids
12+
.idea/**/dataSources.xml
13+
.idea/**/dataSources.local.xml
14+
.idea/**/sqlDataSources.xml
15+
.idea/**/dynamic.xml
16+
.idea/**/uiDesigner.xml
17+
18+
# Gradle:
19+
.idea/**/gradle.xml
20+
.idea/**/libraries
21+
22+
# CMake
23+
cmake-build-debug/
24+
25+
# Mongo Explorer plugin:
26+
.idea/**/mongoSettings.xml
27+
28+
## File-based project format:
29+
*.iws
30+
31+
## Plugin-specific files:
32+
33+
# IntelliJ
34+
/out/
35+
36+
# mpeltonen/sbt-idea plugin
37+
.idea_modules/
38+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
39+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
40+
41+
# User-specific stuff:
42+
*.iml
43+
.idea/**
44+
.idea/**/workspace.xml
45+
.idea/**/tasks.xml
46+
.idea/dictionaries
47+
48+
# Sensitive or high-churn files:
49+
.idea/**/dataSources/
50+
.idea/**/dataSources.ids
51+
.idea/**/dataSources.xml
52+
.idea/**/dataSources.local.xml
53+
.idea/**/sqlDataSources.xml
54+
.idea/**/dynamic.xml
55+
.idea/**/uiDesigner.xml
56+
57+
# Gradle:
58+
.idea/**/gradle.xml
59+
.idea/**/libraries
60+
61+
# CMake
62+
cmake-build-debug/
63+
64+
# Mongo Explorer plugin:
65+
.idea/**/mongoSettings.xml
66+
67+
## File-based project format:
68+
*.iws
69+
70+
## Plugin-specific files:
71+
72+
# IntelliJ
73+
/out/
74+
75+
# mpeltonen/sbt-idea plugin
76+
.idea_modules/
77+
78+
# JIRA plugin
79+
atlassian-ide-plugin.xml
80+
81+
# Cursive Clojure plugin
82+
.idea/replstate.xml
83+
84+
# Crashlytics plugin (for Android Studio and IntelliJ)
85+
com_crashlytics_export_strings.xml
86+
crashlytics.properties
87+
crashlytics-build.properties
88+
fabric.properties# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
89+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
90+
91+
# User-specific stuff:
92+
.idea/**/workspace.xml
93+
.idea/**/tasks.xml
94+
.idea/dictionaries
95+
96+
# Sensitive or high-churn files:
97+
.idea/**/dataSources/
98+
.idea/**/dataSources.ids
99+
.idea/**/dataSources.xml
100+
.idea/**/dataSources.local.xml
101+
.idea/**/sqlDataSources.xml
102+
.idea/**/dynamic.xml
103+
.idea/**/uiDesigner.xml
104+
105+
# Gradle:
106+
.idea/**/gradle.xml
107+
.idea/**/libraries
108+
109+
# CMake
110+
cmake-build-debug/
111+
112+
# Mongo Explorer plugin:
113+
.idea/**/mongoSettings.xml
114+
115+
## File-based project format:
116+
*.iws
117+
118+
## Plugin-specific files:
119+
120+
# IntelliJ
121+
/out/
122+
123+
# mpeltonen/sbt-idea plugin
124+
.idea_modules/
125+
126+
# JIRA plugin
127+
atlassian-ide-plugin.xml
128+
129+
# Cursive Clojure plugin
130+
.idea/replstate.xml
131+
132+
# Crashlytics plugin (for Android Studio and IntelliJ)
133+
com_crashlytics_export_strings.xml
134+
crashlytics.properties
135+
crashlytics-build.properties
136+
fabric.properties
137+
# JIRA plugin
138+
atlassian-ide-plugin.xml
139+
140+
# Cursive Clojure plugin
141+
.idea/replstate.xml
142+
143+
# Crashlytics plugin (for Android Studio and IntelliJ)
144+
com_crashlytics_export_strings.xml
145+
crashlytics.properties
146+
crashlytics-build.properties
147+
fabric.properties
148+
149+
.project
150+
.classpath
151+
.settings
152+
153+
154+
#maven build target
155+
target/

README.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# ScientificCalculator (maven) ZCW
2+
3+
4+
## Description
5+
6+
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.
7+
8+
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.
9+
10+
Then, each of the other team members should clone from the shared repository. You may want to dived the work into various classes, where each person takes responsibility for a whole class.
11+
12+
## Requirements
13+
14+
### Testing
15+
16+
All features must be tested with Test classes. Tests must include normal behavior, and any possible error situations. Tests must have descriptive names and should be independent of each other (running or not running one test should not influence the behavior of any other test).
17+
18+
### Documentation
19+
20+
You must produce UML diagrams for your program. All classes (excluding test classes) must be included in the UML class diagrams. Each class should have a UML box, with variables and a list of methods.
21+
22+
### Core Features
23+
24+
All calculators should have the following features:
25+
26+
- A state, representing the value currently displayed on the calculator (default 0) *
27+
- Get the current number on the display *
28+
- Clear the display *
29+
- Change the number on the display *
30+
- Add, subtract, multiply, and divide the value on the display by a given number
31+
- Calculate the square (x<sup>2</sup>) and square root (√x) of the number on the display *
32+
- Calculate variable exponentiation (x<sup>y</sup>)
33+
- Calculate the inverse of the number on the display (1/x) *
34+
- Invert the sign of the number on the display (switch between positive and negative)
35+
- Update the display to `Err` if an error occurs (eg: Division by zero) *
36+
- Errors must be cleared before any other operation can take place *
37+
38+
Each operation should automatically update the display
39+
40+
41+
### Scientific Features
42+
43+
- Switch display mode (binary, octal, decimal, hexadecimal)
44+
- `switchDisplayMode()` should rotate through the options
45+
- `switchDisplayMode(String mode)` should set the display to the mode given
46+
- Memory - Store up to one numeric value in memory for recall later (default to 0) *
47+
- (`M+` key) Add the currently displayed value to the value in memory (store in memory and update display) *
48+
- (`MC` key) Reset memory *
49+
- (`MRC` key) Recall the current value from memory to the display *
50+
- Trig functions
51+
- Sine - Calculate the sine of the displayed value and display it
52+
- Cosine - Calculate the cosine of the displayed value and display it
53+
- Tangent - Calculate the tangent of the displayed value and display it
54+
- Inverse Sine
55+
- Inverse Cosine
56+
- Inverse Tangent
57+
- Switch trig units mode (Degrees, Radians)
58+
- `switchUnitsMode()` should rotate through the options
59+
- `switchUnitsMode(String mode)` should set the trig units to the type given
60+
- Logarithmic functions
61+
- Log
62+
- 10<sup>x</sup> (inverse logarithm)
63+
- Ln (natural logarithm)
64+
- e<sup>x</sup> (inverse natural logarithm)
65+
- Factorial function
66+
67+
68+
### Custom Features
69+
70+
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.
71+
72+
### Hints
73+
74+
The following functions should take the displayed value (x) and updated it according to the given formula: (this may not be an exhaustive list)
75+
76+
- `square()`: x<sup>2</sup>
77+
- `squareRoot()`: √x
78+
- `inverse()`: <sup>1</sup>/<sub>x</sub>
79+
- `switchSign()`: -x
80+
- `sine()`: sin(x)
81+
- `cosine()`: cos(x)
82+
- `tangent()`: tan(x)
83+
- `inverseSine()`: sin<sup>-1</sup>(x)
84+
- `inverseCosine()`: sin<sup>-1</sup>(x)
85+
- `inverseTangent()`: tan<sup>-1</sup>(x)
86+
- `factorial()`: x! (x factorial)
87+
88+
## Submission
89+
90+
Completed projects should be submitted by submitting a pull request against the [original repository](https://github.com/Zipcoder/ScientificCalculator.Maven). All work should be done in your team's repository.

pom.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>com.zipcodewilmington</groupId>
8+
<artifactId>scientific_calculator</artifactId>
9+
<version>1.0-SNAPSHOT</version>
10+
11+
12+
</project>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package com.zipcodewilmington.scientificcalculator;
2+
3+
import java.util.Scanner;
4+
5+
/**
6+
* Created by leon on 2/9/18.
7+
*/
8+
public class Console {
9+
10+
public static void print(String output, Object... args) {
11+
System.out.printf(output, args);
12+
}
13+
14+
public static void println(String output, Object... args) {
15+
print(output + "\n", args);
16+
}
17+
18+
public static String getStringInput(String prompt) {
19+
Scanner scanner = new Scanner(System.in);
20+
println(prompt);
21+
String userInput = scanner.nextLine();
22+
return userInput;
23+
}
24+
25+
public static Integer getIntegerInput(String prompt) {
26+
return null;
27+
}
28+
29+
public static Double getDoubleInput(String prompt) {
30+
return null;
31+
}
32+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.zipcodewilmington.scientificcalculator;
2+
3+
/**
4+
* Created by leon on 2/9/18.
5+
*/
6+
public class MainApplication {
7+
public static void main(String[] args) {
8+
Console.println("Welcome to my calculator!");
9+
String s = Console.getStringInput("Enter a string");
10+
Integer i = Console.getIntegerInput("Enter an integer");
11+
Double d = Console.getDoubleInput("Enter a double.");
12+
13+
Console.println("The user input %s as a string", s);
14+
Console.println("The user input %s as a integer", i);
15+
Console.println("The user input %s as a d", d);
16+
}
17+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package com.zipcodewilmington.scientific_calculator;
2+
3+
/**
4+
* Created by leon on 2/9/18.
5+
*/
6+
public class TestMainApplication {
7+
}

0 commit comments

Comments
 (0)