BUSINESS CASE A healthy lifestyle advocacy group is aiming to build a bike shari
ID: 3745423 • Letter: B
Question
BUSINESS CASE A healthy lifestyle advocacy group is aiming to build a bike sharing system within a medium-size metropolitan area. The group has signed a contract with a company to provide the bike sharing technology and hardware (bike stations, bikes, network equipment, a server, and bike sharing software that automates the process of checking out and returning bicycles, and billing customers). The docking station provides a limited number of bike parking spots and is characterized by its location, bike capacity, and by real-time number of bikes parked. Docking stations have computers running on them, credit card reader, and a networking module which allows it to be connected to the Internet. The fleet of bikes has also been purchased.
FUNCTIONING OF THE SYSTEM There are two ways a user can get access to the system: 1) Using her annual subscription ($70) - 2) Buying day pass ($5) Every ride under 30 minutes is free. User is charged $1 dollar for a ride between 30 and 1 hour, 3 dollars for rides between 1 hour and 2 hours and a flat rate of 7 dollars for any ride over 2 hours. The users who haven’t returned a bike within 10 hours are billed with a $50 fine.
REGISTRATION PROCESS A user can register online or purchase a day pass at the station.
The information system designed for this case should connect docking stations, as well as manage user registrations and billing.
Directions
Assuming that subscription_status == 1 is an annual subscriber and subscription_status == 2 is a daily subscriber for the day stored in the variable day_subscribed and the current day stored in a variable now, pickup_time and drop_off_time are the times in minutes,
write a Python code to describe subscription check and the price calculation for a single ride.
Explanation / Answer
#NOTE:-
#Python Program to check subscription type and calculate fair.
#This program runs on python 3
#For simplicity i have asked the details from user. Otherwiise system details can be feed in directly
print(" Menu: Enter 1 if you have annual subscription. Enter 2 if you have a daily subscription.")
subscription_status = int(input(" Please enter your subscription type: ")) #Storing susbcription type
if subscription_status==1 or subscription_status==2:
print("Welcome to Bike Riding!!!!")
print("Want to know your fare :")
print("1. Monday 2.Tuesday 3.Wednesday 4.Thursday 5.Friday 6.Saturday 7.Sunday")
now = int(input("Please enter a valid day(in number): "))
pickup_time = int(input("Please enter your pick up time(in minutes) :"))
drop_off_time = int(input("Please enter your drop of time(in minutes) :"))
calculate_fare(now,pickup_time,drop_off_time) #c Calling calculate_fair function to calculate fair as per the details given by system/user.
else: #In case user enter a wrong choice
print("Sorry, You entered a worng choice")
print("Buy a subscription and enjoy riding!!!!")
def calculate_fare(now,pickup_time,drop_off_time): # Calculate_fair function
ride_time = drop_off_time-pickup_time
if ride_time<=30:
print("Your fair for journey is 0.")
elif ride_time>30 and ride_time<=60:
print("Your fair for journey is 1 dollar.")
elif ride_time>60 and ride_time<=120:
print("Your fair for journey is 3 dollar.")
elif ride_time>120 and ride_time<=600:
print("Your fair for journey is 7 dollar.")
elif ride_time>600:
print("Since your riding time exceeds 10 hours. So you need to a fine of 50 dollars")
else:
print("You eneter something wrong.. PLease try again.. Thank You")
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.