forked from meanjeekim/ford-functions-lab-in-js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
56 lines (44 loc) · 1.53 KB
/
Copy pathindex.js
File metadata and controls
56 lines (44 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
* The moneySaver function takes in student info and returns a string
* that details the amount of money they would save on gas if they
* switched to the Ford Fusion Hybrid.
*
* @param {string} studentName - The name of the student
* @param {number} cityMpg - The city miles per gallon their current car gets
* @param {number} highwayMpg - The highway miles per gallon their current car gets
* @param {number} cityMiles - The number of personal city miles they drive in one year
* @param {number} highwayMiles - The number of personal highway miles they drive in one year
* @param {number} days - The number of days that student drives per year
*
* @return {string} Information about a user's annual gas savings
*/
function moneySaver(studentName, cityMpg, highwayMpg, cityMiles, highwayMiles, days){
// Savings will store the result of all the calculations
var savings = 0
var answer
// Variables: mpg for the Ford Fusion Hybrid
// Store the value of running the calculateCostOfGas function for each
// car.
// Calculate savings
// Construct answer
// Return answer
return answer
}
/*
* The calculateCostOfGas function
*
* @param {number} days
* @param {number} cityMpg
* @param {number} highwayMpg
* @param {number} cityMilesPerDay
* @param {number} highwayMilesPerDay
*
* @return {number} totalCost
*/
function calculateCostOfGas(){
var costPerGallon = 2.95
var totalCost = 0
// Do all calculations here
// Good luck!
return totalCost
}