Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE USE JAVA TO WIRTE THIS CODE AND INCLUDE COMMENTS TO EXPLAIN STEPS. THANK YOU! Question 1: Taxi Fare Estimator You are asked to develop

image text in transcribed

image text in transcribed

image text in transcribed

PLEASE USE JAVA TO WIRTE THIS CODE AND INCLUDE COMMENTS TO EXPLAIN STEPS. THANK YOU!

Question 1: Taxi Fare Estimator You are asked to develop a taxi fare estimator for a Montreal taxi company. Users who are interested in receiving taxi service may use the estimator to get a quote for a ride. The taxi company offers ride service in Greater Montreal Area. There are a few factors that determine the taxi fare for a ride, i.e., car model, distance, whether or not the ride time is within rush hours. There are two types of cars that may provide ride service: base car models and limo car models. Depending on which rush hours the taxi service is provided, the fare will increase accordingly. In short, the total fare equals to the fare per km for each car model times ($/km) the estimated distance (km) times a rush hour ratio (%). - For base car model, the fare per km is $0.81; - For limo car model, the fare per km is $1.55; - If the ride is on any weekdays, there are three rush hour ratios that may apply: If between 8am and 10am or between 4pm and 5pm, the rush hour ratio is 1.5; If between midnight (12am) and 6am, the rush hour ratio is 2; O For the remaining time, the rush hour ratio is 1. - If the ride is on weekend, there are two rush hour ratios that may apply: o If between midnight (12am) and 6am, the rush hour ratio is 2; For the remaining time, the rush hour ratio is 1.3. Below are two sample outputs to demonstrate the expected behavior of your program. Note: User input is highlighted in green. Your program must display the same information but can be formatted differently. Welcome to Montreal Taxi Fare Estimator! ** * Please select your taxi car model: 1 - base car 2 - limo car Please enter the digit corresponding to your case: (1 or 2) Please select which day you will be using the taxi service: 1 - Weekday 2 - Weekend Please select the time you will be using the taxi service: 1 - During 8am - 10am and 4pm - 5pm 2 - From midnight 12am to 6am 3 - None of the above Please enter the estimated distance (km) of your ride: Your estimated fare is $79.05000000000001 Thank you for using our service! -- *-- * -- -- - Welcome to Montreal Taxi Fare Estimator! -----*** ----**- * * * Please select your taxi car model: 1 - base car 2 - limo car Please enter the digit corresponding to your case: (1 or 2) Please select which day you will be using the taxi service: 1 - Weekday 2 - Weekend Please select the time you will be using the taxi service: 1 - Between midnight 12am and 6am 2 - None of the above Please enter the estimated distance (km) of your ride: Your estimated fare is $14.742 Thank you for using our service! JAVA

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

Graph Databases In Action

Authors: Dave Bechberger, Josh Perryman

1st Edition

1617296376, 978-1617296376

More Books

Students also viewed these Databases questions