Purchase Solution

Javascript function that computes a taxi fare.

Not what you're looking for?

Ask Custom Question

1. Write a function that computes a taxi fare. In some cities, taxi fares are calculated based on start and end zones plus a per-minute charge. In this city, there are three zones (1, 2, and 3) and a graduated scale for time. Thus, your function should receive three parameters: the starting zone, the ending zone, and the time of the ride. It should return the total fare for the ride. Use the following table for your calculations:

Start zone End zone Base charge
1 1 $5.00
1 2 $7.00
1 3 $8.00
2 1 $7.00
2 2 $5.00
2 3 $9.00
3 1 $8.00
3 2 $9.00
3 3 $5.00

Time is more than But is not over Charge
0 minutes 4 minutes $0.75 per minute
4 minutes 10 minutes $3.00 plus $0.50 per minute over 4 minutes
10 minutes 20 minutes $6.00 plus $0.40 per minute over 10 minutes
20 minutes No limit $10.00 plus $0.30 per minute over 20 minutes

Purchase this Solution

Solution Summary

Fully working javacode is provided for the said problem with comments. Easy to follow code...

Solution Preview

Hi,

Kindly find the attached javascript function for the said problem. The function calculates the fare based ...

Purchase this Solution


Free BrainMass Quizzes
Javscript Basics

Quiz on basics of javascript programming language.

Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.

Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.

Basic Networking Questions

This quiz consists of some basic networking questions.