Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MATLAB question: l. (8 points) Nadia, our gymnastics friend from lecture 7, enjoys her morning coffee - a lot! To save money, Nadia and a

MATLAB question:

image text in transcribed

l. (8 points) Nadia, our gymnastics friend from lecture 7, enjoys her morning coffee - a lot! To save money, Nadia and a few friends have joined together to purchase coffee beans in bulk. They are purchasing online from Bulk Beans. The Bulk Beans price for coffee beans is $18 per kg for 0-5 kg. The price for additional beans beyond 5 kg is $16/kg up to 20 kg. Above 20 kg, the price drops to $14/kg. There is a flat $11.50 delivery charge; however, the delivery charge is waved for purchases above $200. Once a subtotal price is determined based on weight and delivery, a 17% tax is added to form the final price. As an example, 27 kg of coffee beans would cost $18 x 5 + $16 (20-5) + $14 * 7 = $428.00 for the beans, plus $0 for delivery, plus 0.17 ~ $428.00 = $72.76 in taxes, for a total of $500.76. Ouch! Write a MATLAB program (a3q1.m) to simulate the purchase of coffee from Bulk Beans. Begin by prompting the user to enter the number of kilograms to purchase. Then, compute the purchase price as described above. Output the price to the command window with two decimal places. If a negative value is input, respond with "Invalid" and terminate immediately using MATLAB's return command. For generating output to the command window, only use the disp function. Below are some example interactions. User input is underlined

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

Ai And The Lottery Defying Odds With Intelligent Prediction

Authors: Gary Covella Ph D

1st Edition

B0CND1ZB98, 979-8223302568

More Books

Students also viewed these Databases questions