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.)
Copy file name to clipboardexpand all lines: homework/wk1d3/README.md
+3-1
Original file line number
Diff line number
Diff line change
@@ -8,12 +8,14 @@
8
8
- The 6 line has the following stops: Grand Central, 33rd, 28th, 23rd, Union Square, and Astor Place.
9
9
- All 3 subway lines intersect at Union Square, but there are NO other intersection points.
10
10
- For example, this means the 28th stop on the N line is different than the 28th street stop on the 6 line, so you'll have to differentiate this when you name your stops in the arrays.
11
+
11
12
- The program takes the line and stop that a user is getting on at and the line
13
+
- The program takes the line and stop that a user is getting on at and the line
12
14
and stop that user is getting off at and prints the total number of stops for the trip.
13
15
14
16
---
15
17
16
-
###Hints:
18
+
###Hints:
17
19
- Get the program to work for a single line before trying to tackle multiple lines.
18
20
- Consider diagraming the lines by sketching out the subway lines and their stops and intersection.
19
21
- Make subway lines keys in a hash, while the values are an array of all the stops on each line.
0 commit comments