Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

43. Due Date: 13 November Reading: Think CS: Chapter 6 Write a function, computeFare), that takes as two parameters: the zone and the ticket type,

image text in transcribed

image text in transcribed

43. Due Date: 13 November Reading: Think CS: Chapter 6 Write a function, computeFare), that takes as two parameters: the zone and the ticket type, and returns the MetroNorth Railroad fare. If the zone is 1 and the ticket type is "peak", the fare is 6.75. If the zone is 1 and the ticket type is "off-peak", the fare is 5.00 o If the zone is 1 and the ticket type is "senior", the fare is 3.25. If the zone is 2 and the ticket type is "peak", the fare is 7.50. o If the zone is 2 and the ticket type is "off-peak", the fare is 5.75 o If the zone is 2 and the ticket type is "senior", the fare is 3.75 If the zone is 3 and the ticket type is "peak", the fare is 9.25 o If the zone is 3 and the ticket type is "off-peak", the fare is 7.00 o If the zone is 3 and the ticket type is "senior", the fare is 4.50 o If the zone is greater than 3, return a negative number (since your calculator does not handle inputs that high) A template program, MNRtransit.py, is available on the CSci 127 repo on github. The grading script does not run the whole program, but instead tests your function separately (unit tests') to determine correctness. As such, the name of the function must match exactly (else, the scripts cannot find) A sample run: Enter the number of zones: 2 Enter the ticket type (peak/off-peak): off-peak The fare is 5.75 And another: Enter the number of zones: 6 Enter the ticket type (peak/off-peak): peak The fare is -1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design For Mere Mortals

Authors: Michael J Hernandez

4th Edition

978-0136788041

More Books

Students also viewed these Databases questions

Question

Determine A x B. 4 21 3] 3 A = [3 :- 5 6, B = 3.

Answered: 1 week ago

Question

=+j Describe the various support services delivered by IHR.

Answered: 1 week ago

Question

czl&)

Answered: 1 week ago

Question

What is DDL?

Answered: 1 week ago