Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please do #10 using matlab. Thank you 0 0 file:///C:/Users/rp514/Downloads/Homework%205.pdf - + O DIA A VOTUCAT Fomu urspray Terung TONOW.TIC Torg is # Question #9.

Please do #10 using matlab. Thank you image text in transcribed
0 0 file:///C:/Users/rp514/Downloads/Homework%205.pdf - + O DIA A VOTUCAT Fomu urspray Terung TONOW.TIC Torg is # Question #9. Using an if/else construct, write a script to calculate the tip of a restaurant bill. . Using the command window, ask the user to enter the bill amount. Then ask the user to type if the service was 1) good, 2) average, or 3) bad. 1. If the user typed good, display the bill total including a 20% tip. 2. If the user typed average, display the bill total including an 18% tip. 3. If the user typed bad, display the total including a 15% tip. 4. If the user entered anything other than the three acceptable words, print that the input was invalid and exit the script using a return statement. Be sure your calculated total is formatted as currency (including a dollar sign and precision to two decimal places). Question #10. Rewrite the same restaurant tip script from Question 9, but implement it using a case/switch construct instead of an if/else construct

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

The Accidental Data Scientist

Authors: Amy Affelt

1st Edition

1573877077, 9781573877077

More Books

Students also viewed these Databases questions

Question

Evaluate three pros and three cons of e-prescribing

Answered: 1 week ago

Question

Know the three main dimensions of the service environment.

Answered: 1 week ago