Bladeren bron

Upload calculator Requirements

David Ginzberg 8 jaren geleden
bovenliggende
commit
58d04ce267
1 gewijzigde bestanden met toevoegingen van 83 en 1 verwijderingen
  1. 83
    1
      README.md

+ 83
- 1
README.md Bestand weergeven

@@ -1 +1,83 @@
1
-# project-1-calculator
1
+# Project 1: Calculator
2
+
3
+
4
+## Description
5
+
6
+In this project you 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
+
9
+## Requirements
10
+
11
+### Testing
12
+
13
+All features must be tested. 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).
14
+
15
+### Documentation
16
+
17
+You must produce UML diagrams for your program. All classes (excluding test classes) must be included in the UML class diagrams.
18
+
19
+### Core Features
20
+
21
+All calculators should have the following features:
22
+
23
+- A state, representing the value currently displayed on the calculator (default 0) *
24
+- Get the current number on the display *
25
+- Clear the display *
26
+- Change the number on the display *
27
+- Add, subtract, multiply, and divide the value on the display by a given number
28
+- Calculate the square (x<sup>2</sup>) and square root (√x) of the number on the display *
29
+- Calculate variable exponentiation (x<sup>y</sup>)
30
+- Calculate the inverse of the number on the display (1/x) *
31
+- Invert the sign of the number on the display (switch between positive and negative)
32
+- Update the display to `Err` if an error occurs (eg: Division by zero) *
33
+- Errors must be cleared before any other operation can take place *
34
+
35
+Each operation should automatically update the display
36
+
37
+
38
+### Scientific Features
39
+
40
+- Switch display mode (binary, octal, decimal, hexadecimal)
41
+  - `switchDisplayMode()` should rotate through the options
42
+  - `switchDisplayMode(String mode)` should set the display to the mode given
43
+- Memory - Store up to one numeric value in memory for recall later (default to 0) *
44
+  - (`M+` key) Add the currently displayed value to the value in memory (store in memory and update display) *
45
+  - (`MC` key) Reset memory *
46
+  - (`MRC` key) Recall the current value from memory to the display *
47
+- Trig functions
48
+  - Sine - Calculate the sine of the displayed value and display it
49
+  - Cosine - Calculate the cosine of the displayed value and display it
50
+  - Tangent - Calculate the tangent of the displayed value and display it
51
+  - Inverse Sine
52
+  - Inverse Cosine
53
+  - Inverse Tangent
54
+- Switch trig units mode (Degrees, Radians)
55
+  - `switchUnitsMode()` should rotate through the options
56
+  - `switchUnitsMode(String mode)` should set the trig units to the type given
57
+- Logarithmic functions
58
+  - Log
59
+  - 10<sup>x</sup> (inverse logarithm)
60
+  - Ln (natural logarithm)
61
+  - e<sup>x</sup> (inverse natural logarithm)
62
+- Factorial function  
63
+
64
+
65
+### Custom Features
66
+
67
+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.
68
+
69
+### Hints
70
+
71
+The following functions should take the displayed value (x) and updated it according to the given formula: (this may not be an exhaustive list)
72
+
73
+- `square()`: x<sup>2</sup>
74
+- `squareRoot()`: √x
75
+- `inverse()`: <sup>1</sup>/<sub>x</sub>
76
+- `switchSign()`: -x
77
+- `sine()`: sin(x)
78
+- `cosine()`: cos(x)
79
+- `tangent()`: tan(x)
80
+- `inverseSine()`: sin<sup>-1</sup>(x)
81
+- `inverseCosine()`: sin<sup>-1</sup>(x)
82
+- `inverseTangent()`: tan<sup>-1</sup>(x)
83
+- `factorial()`: x! (x factorial)