Final answer:
To calculate the total cost of traveling by car to work, you need to consider distance, cost per liter of gasoline, performance, toll fees, and parking fees. The total cost can be calculated using the formula Total Cost = (Distance / Performance) * Cost per liter of gasoline + Toll fees + Parking fees. The price per person can be obtained by dividing the total cost by the number of passengers.
Step-by-step explanation:
To create a program that calculates the total cost of traveling by car to work, you will need to consider several factors:
- Distance in kilometers
- Cost per liter of gasoline
- Performance in kilometers per liter
- Toll fees
- Parking fees
To calculate the total cost, you can use the formula: Total Cost = (Distance / Performance) * Cost per liter of gasoline + Toll fees + Parking fees.
To calculate the price per person, you can divide the total cost by the number of passengers. Here are the prices per person for 1, 2, 3, 4, and 5 passengers:
- 1 passenger: Total Cost
- 2 passengers: Total Cost / 2
- 3 passengers: Total Cost / 3
- 4 passengers: Total Cost / 4
- 5 passengers: Total Cost / 5