computer S programming

profiledanya.alsinan

Uber needs a program to compute how much to charge its passengers.

A fare consists of a service fee (booking fee), a base fare (a flat rate you pay for getting in the car), a per-minute-stopped-in-traffic cost, and a per-mile-driven cost.

Write a program that computes the cost and then outputs this information to the console window.  Store all four rates as constants and the minutes in the car and miles driven as variables. Then compute the total cost.

You can find the current rates for UberX in Denver at: http://uberestimate.com/prices/Denver/ (Links to an external site.)Links to an external site. You’ll need to scroll down just a bit to find the UberX rates.

Test your program with several values.

Now add surge pricing to your program. Surge pricing occurs during times of high demand. We will calculate surge pricing by multiplying the cost by 2.5. Be sure to represent this number as a constant.

Print both the cost without and with surge pricing to the console window.

Your output might look something like this:

Minutes in car: 20
Miles driven: 10
Cost without surge pricing: $17.15
Cost with surge pricing: $42.875


  • 9 years ago
  • 5
Answer(0)