You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Practice with functions, loops, conditions, user-input, switch/case
5
+
6
+
###Activity:
7
+
- Students should work on this lab in groups.
8
+
9
+
###Explanation
10
+
- You will be building a calculator. A calculator can perform multiple arithmetic operations. Your function should allow the user to choose which operation is expected, enter in the values to perform the operation on, and ultimately view the result.
11
+
- The instructor should carefully step through the lab with the students, as they type out the requirements for each specification.
12
+
- Consider having the students make git commits as they finish each phase, so they can see the history
13
+
14
+
###Specification:
15
+
- A user should be given a menu of operations
16
+
- A user should be able to choose from the menu
17
+
- A user should be able to enter numbers to perform the operation on
18
+
- A user should be shown the result
19
+
- This process should continue until the user selects a quit option from the menu
20
+
21
+
#####Phase 1
22
+
- Calculator functionality
23
+
- Calculator should be able to do basic arithmetic (+,-, *, /)
24
+
25
+
#####Phase 2
26
+
- Advanced Calculator functionality
27
+
- Calculator should be able to do basic arithmetic (exponents, square roots)
28
+
29
+
#####Phase 3
30
+
- User should be given a menu of Calculator functionality
31
+
- User should be able to choose indented functionality
* Calculate the monthly payment when given the other variables as input.
39
+
*[BMI:](http://www.wikihow.com/Image:BMI.jpg)
40
+
* Calculate the BMI when given the height and weight.
41
+
42
+
## Trip Calculator
43
+
44
+
* This option asks the user for four inputs:
45
+
* Distance – how far will you drive?
46
+
* MPG – what is the fuel efficiency of the car?
47
+
* $PG – how much does gas cost per gallon?
48
+
* Speed – how fast will you drive?
49
+
50
+
* The output is a string: "Your trip will take 3.5 hours and cost $255.33."
51
+
* For every 1 MPH over 60 MPH, reduce the the MPG by 2 MPG. (i.e. a car that normally gets 30 mpg would only get 28 mpg if its speed were 61 mph. Yes this gets silly at high speed where mpg goes to zero or gets negative.)
0 commit comments