(Car-Pool Savings Calculator) Research several car-pooling websites. Create an application that calculates your daily driving cost,...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
(Car-Pool Savings Calculator) Research several car-pooling websites. Create an application that calculates your daily driving cost, so that you can estimate how much money could be saved by car pooling, which also has other advantages such as reducing carbon emissions and reducing traffic congestion. The application should input the following information and display the user's cost per day of driving to work: a) Total miles driven per day. b) Cost per gallon of gasoline. c) Average miles per gallon. d) Parking fees per day. e) Tolls per day. 123 import java.util.Scanner; public class CarpoolingApp { public static void main(String[] args) 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 //Using Scanner Scanner input = new Scanner(System.in); // Declare of each variable int totalMilesDriven, numberDay; int parkingFees; double milesDay; double gallon; double costGallons; double milesGallon; double parkingFees Amount; double tollDay; int cost; // Enter of the user System.out.print ("Total Miles Driven of the user: "); totalMilesDriven = input.nextInt(); System.out.print("Number days of the user: "); numberDay = input.nextInt(); System.out.print ("Number of gallon of gasoline that the user using: "); gallon = input.nextDouble(); System.out.print ("Cost of the user: "); cost = input.nextInt(); System.out.print("Parking Free: "); parkingFees = input.nextInt(); // Calculate milesDay = totalMiles Driven numberDay; 18 19 20 21 22 23 24 25 26 27 28 29 ava pr 16 17. double parking Fees Amount; double tollDay; int cost; // Enter of the user System.out.print("Total Miles Driven of the user: "); totalMilesDriven = input.nextInt(); System.out.print("Number days of the user: "); number Day = input.nextInt(); System.out.print("Number of gallon of gasoline that the user using: "); gallon = input.nextDouble(); System.out.print("Cost of the user: "); cost = input.nextInt(); System.out.print("Parking Free: "); 30 parkingFees = input.nextInt(); 31 32 33 34 35 36 37 // Calculate milesDay = totalMiles Driven numberDay; costGallons = cost / gallon;| milesGallon = totalMiles Driven / gallon; parkingFees Amount = parking Fees / numberDay; tollDay = ((costGallons + parking Fees Amount)/number Day); 38 39 //Display the information money of the user 40 41 42 43 44 System.out.printf("Total miles driven per day: %f ", milesDay); System.out.printf("Cost per gallon of gasoline: %f ", costGallons ); System.out.printf("Average miles per gallons: %f ", milesGallon); System.out.printf("Parking fees per day: %f ", parkingFees Amount); System.out.printf("Tolls per day: %f ", tollDay); 45 } 46 } 67 (Car-Pool Savings Calculator) Research several car-pooling websites. Create an application that calculates your daily driving cost, so that you can estimate how much money could be saved by car pooling, which also has other advantages such as reducing carbon emissions and reducing traffic congestion. The application should input the following information and display the user's cost per day of driving to work: a) Total miles driven per day. b) Cost per gallon of gasoline. c) Average miles per gallon. d) Parking fees per day. e) Tolls per day. 123 import java.util.Scanner; public class CarpoolingApp { public static void main(String[] args) 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 //Using Scanner Scanner input = new Scanner(System.in); // Declare of each variable int totalMilesDriven, numberDay; int parkingFees; double milesDay; double gallon; double costGallons; double milesGallon; double parkingFees Amount; double tollDay; int cost; // Enter of the user System.out.print ("Total Miles Driven of the user: "); totalMilesDriven = input.nextInt(); System.out.print("Number days of the user: "); numberDay = input.nextInt(); System.out.print ("Number of gallon of gasoline that the user using: "); gallon = input.nextDouble(); System.out.print ("Cost of the user: "); cost = input.nextInt(); System.out.print("Parking Free: "); parkingFees = input.nextInt(); // Calculate milesDay = totalMiles Driven numberDay; 18 19 20 21 22 23 24 25 26 27 28 29 ava pr 16 17. double parking Fees Amount; double tollDay; int cost; // Enter of the user System.out.print("Total Miles Driven of the user: "); totalMilesDriven = input.nextInt(); System.out.print("Number days of the user: "); number Day = input.nextInt(); System.out.print("Number of gallon of gasoline that the user using: "); gallon = input.nextDouble(); System.out.print("Cost of the user: "); cost = input.nextInt(); System.out.print("Parking Free: "); 30 parkingFees = input.nextInt(); 31 32 33 34 35 36 37 // Calculate milesDay = totalMiles Driven numberDay; costGallons = cost / gallon;| milesGallon = totalMiles Driven / gallon; parkingFees Amount = parking Fees / numberDay; tollDay = ((costGallons + parking Fees Amount)/number Day); 38 39 //Display the information money of the user 40 41 42 43 44 System.out.printf("Total miles driven per day: %f ", milesDay); System.out.printf("Cost per gallon of gasoline: %f ", costGallons ); System.out.printf("Average miles per gallons: %f ", milesGallon); System.out.printf("Parking fees per day: %f ", parkingFees Amount); System.out.printf("Tolls per day: %f ", tollDay); 45 } 46 } 67
Expert Answer:
Related Book For
Posted Date:
Students also viewed these programming questions
-
Managing Scope Changes Case Study Scope changes on a project can occur regardless of how well the project is planned or executed. Scope changes can be the result of something that was omitted during...
-
1 What are the main components of personal financial planning? Solve What is the purpose of a financial plan? Solve Identify some common actions taken to achieve financial goals. How does a job...
-
The Unilever Bangladesh Limited has a plant in Narayanganj, manufacturing Dove shampoo made from the ingredient imported from abroad. The company claims that each bottle of 200ml contain on average...
-
The reaction between ethyl iodide and hydroxide ion in ethanol (C2H5OH) solution, C2H5I(alc) + OH (alc) -- C2H5OH(I) + I(alc), has an activation energy of and a frequency factor of 2.10 1011 M-1...
-
Add avoidmethodaddInOrderto theLinkedListclass which takes an integervalas a parameter. It should find the correct location in the already-sorted (lowest to highest) list forval, then make a new node...
-
For each of the following, calculate the standard error of the difference \(\left(s \mathrm{X}^{-} 1-\mathrm{X}^{-} ight.\) 2 ) and the \(t\)-test for independent means. a. N = 6, N = 6, X 1 18.50, $...
-
The wearever Shoe Company is going to open a new branch at a mall, and company manager are attempting to determine how many sales-people to hire Based on an analysis of mall traffic. The company...
-
Why should bond investors be cautious when relying on yield to maturity? Is it an accurate measure of rate of return for investors who might not hold their bonds to maturity?
-
Exhibit 5.26 presents risk ratios for Walmart for 2014 and 2013. Exhibits 1.19, 1.20, and 1.21 in Chapter 1 present the financial statements for Walmart. REQUIRED a. Compute the values of each of the...
-
Have you ever tried baklava? if you have, did you like it? was it too sweet or not sweet enough? was it authentic baklava?
-
When you drive, rather than walk or take public transportation, you incur social costs such as ______.
-
An individual can build up his or her capital ______. a) by working longer hours only b) by cutting back on consumption only c) by both cutting back on consumption and working longer hours d) by...
-
Where is a price ceiling with respect to equilibrium price? What will be the relative size of quantity demanded and quantity supplied?
-
Which statement is the most accurate? a) Most of the worlds economies are close copies of the American capitalist model. b) The Chinese economy can best be described as democratic socialist. c)...
-
Capital comes from ______. a) gold b) savings c) high consumption d) the government
-
As chief financial officer of Uptown Service Corporation (USC), you are considering a recapitalization plan that would convert USC from its current all-equity capital structure to one including...
-
From 1970 to 1990, Sri Lanka's population grew by approximately 2.2 million persons every five years. The population in 1970 was 12.2 million people.What is the best formula for P, Sri Lanka's...
-
Acne Medication and Gastrointestinal Injury Since 1999, Kamie Kendall had experienced ongoing abdominal pain, and she was eventually diagnosed with ulcerative colitis and irritable bowel syndrome...
-
James Lewis, a resident of Kentucky, sustained an injury while operating a Caterpillar bulldozer. He filed suit against Caterpillar, a company incorporated in Delaware but with its principal place of...
-
In 1951, DuPont began using the chemical perfluorooctanoic acid to manufacture Teflon. Due to the dangerous nature of the chemical, DuPont was given special instructions by its supplier to dispose of...
Study smarter with the SolutionInn App