Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Express your algorithm as pseudocode or a flowchart. Print the Ferries Fare Information menu to the user (see sample run and table below). Note that

  • Express your algorithm aspseudocode or aflowchart.
  • Print the Ferries Fare Information menu to the user (see sample run and table below).
  • Note that the Bike Charge is included in the Vehicle Fee. Meaning if they have a Vehicle do not ask for the Number of Bikes. See sample run below for clarification.
  • program must prompt the user for information exactly as shown in the sample run below. This is a required coding construct.
  • If the user enters an invalid answer for the first question (use a char for this question and if they answer anything other than y/n), must output an error message and end the program.
  • This question should accept both upper case and lower case answers.
  • If the user enters any invalid numbers, print an error message and end the program. This could be negative numbers for any numbers, or unreasonable amounts for the number of people.No more than 20 people per group (not including the driver!).
  • Calculate the total price based on the ticket type and number of tickets.
  • If the total price is over $100, output a message saying they get a free adult ticket for their next trip. Else output the difference and tell them how much they need to spend to earn the free ticket.
  • no have any redundant code inside if statements. have if else statements where appropriate or may use switch statements.
  • No goto statements or break statements allowed except inside a switch statement.
  • Output the amount formatted to 2 decimal places with proper money formatting.
  • Look at the sample run below for examples.
  • Use this simplified fare table below for calculations:

Fare Information

Passenger and vehicle/driver fares are collected at Ana cortes, while no fares are collected at Friday Harbor.

Fare Description Cost per ticket
Vehicle Under 14' (less than 168") & Driver $57.90
Adult (age 19 - 64) $14.95
Senior (age 65 & over) / Disability $7.40
Youth (age 6 - 18) $5.55
Bicycle Surcharge (included with Vehicle) $4.00

* The pricing for these items are made up for this assignment. Please check out Washington State Ferries Vehicle Reservations Home Page to get their latest fare information.

Criteria for Success

  • Test program using the following sample runs, making sure get the same output when using the given inputs (inblue):

Welcome to the Washington State Ferries Fare Calculator!

Fare Description Ticket $

-------------------------------------- --------

Vehicle Under 14' (less than 168") & Driver $57.90

Adult (age 19 - 64) $14.95

Senior (age 65 & over) / Disability $7.40

Youth (age 6 - 18) $5.55

Bicycle Surcharge (included with Vehicle) $4.00

Are you riding a vehicle on the Ferry (Y/N):y

How many adults? 2

How many seniors? 1

How many youths? 0

Your total charge is $95.20

If you spend $4.80 more, you are eligible for a free adult ticket for next trip.

Thank you for using Washington State Ferries Fare Calculator!

Welcome to the Washington State Ferries Fare Calculator!

Fare Description Ticket $

-------------------------------------- --------

Vehicle Under 14' (less than 168") & Driver $57.90

Adult (age 19 - 64) $14.95

Senior (age 65 & over) / Disability $7.40

Youth (age 6 - 18) $5.55

Bicycle Surcharge (included with Vehicle) $4.00

Are you riding a vehicle on the Ferry (Y/N):a

Error!! Invalid answer!! Please try again later!!!

Thank you for using Washington State Ferries Fare Calculator!

Welcome to the Washington State Ferries Fare Calculator!

Fare Description Ticket $

-------------------------------------- --------

Vehicle Under 14' (less than 168") & Driver $57.90

Adult (age 19 - 64) $14.95

Senior (age 65 & over) / Disability $7.40

Youth (age 6 - 18) $5.55

Bicycle Surcharge (included with Vehicle) $4.00

Are you riding a vehicle on the Ferry (Y/N):n

How many adults?2

How many seniors?1

How many youths?1

How many bikes?2

Your total charge is $50.85

If you spend $49.15 more, you are eligible for a free adult ticket for next trip.

Thank you for using Washington State Ferries Fare Calculator!

Welcome to the Washington State Ferries Fare Calculator!

Fare Description Ticket $

-------------------------------------- --------

Vehicle Under 14' (less than 168") & Driver $57.90

Adult (age 19 - 64) $14.95

Senior (age 65 & over) / Disability $7.40

Youth (age 6 - 18) $5.55

Bicycle Surcharge (included with Vehicle) $4.00

Are you riding a vehicle on the Ferry (Y/N):n

How many adults?-7

Error!! Invalid answer!! Please try again later!!!

Thank you for using Washington State Ferries Fare Calculator!

Welcome to the Washington State Ferries Fare Calculator!

Fare Description Ticket $

-------------------------------------- --------

Vehicle Under 14' (less than 168") & Driver $57.90

Adult (age 19 - 64) $14.95

Senior (age 65 & over) / Disability $7.40

Youth (age 6 - 18) $5.55

Bicycle Surcharge (included with Vehicle) $4.00

Are you riding a vehicle on the Ferry (Y/N):n

How many adults?12

How many seniors?4

How many youths?5

How many bikes?2

Uh oh!! Too many people in your group. Split into 2 groups and try again!

Thank you for using Washington State Ferries Fare Calculator!

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

what are the risks to the buyer in a fixed price contract

Answered: 1 week ago