Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using matlab 4. Write a program to calculate the cost of a shopping trip at a thrift store. The cost of this shopping trip will

Using matlab image text in transcribed
4. Write a program to calculate the cost of a shopping trip at a thrift store. The cost of this shopping trip will depend upon both the type of item you buy, as well as the weight of your item. Your code should ask the user to input what type of item they are buying (small housewares, clothing, or books and other heavy objects), and also the weight of their purchase. Weight should be input as a vector comprised of lbs & oz. (1st value is the lbs and 2nd is oz. ex: instead of 6.25 lb it is (6,4]). After calculating the cost of the shopping trip, display the following to the user: "The cost of your shopping trip to purchase X pounds X ounces of ITEM TYPE will be SXXX.XX." Be sure to display your output as shown in the previous sentence using proper formatting. This problem must use the input or menu command, conditional statements, and the fprintf command. The table below displays the costs per item type and weight which you will need to consider for Problem 4 Weight 0-5 Ibs Weight 5-10 lbs more than 10 $4 $0.75 for each$7.75+$0.60 for each additional lb or fraction additional lb or fraction of a Ib above 5 lbs $8+ $0.06 for each additional oz or of a lb above 10 lbs $12.8+$0.04 for each Clothing $1.60/lb additional oz or fraction of an oz above fraction of an oz above 5 lbs 10 lbs $2.95 $0.50 for each $5.45+$0.40 for each additional pound above additional lb above 10 objects, or 0.59/lb Books and other heavy objects 5 lbs To make things easier, you may ask the user to enter 1 for housewares, 2 for clothes, 3 for books and other heavy you can use the menu command.)

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