Question: using MatLab please using MatLab please (b) Shop A is selling a beverage which costs $2 per bottle and there are rules for promotional sales

 using MatLab please using MatLab please (b) Shop A is selling
using MatLab please
using MatLab please

(b) Shop A is selling a beverage which costs $2 per bottle and there are rules for promotional sales for the beverage: You can exchange 4 caps for 1 full bottle of the same beverage for free; . You can exchange 2 empty bottles (without cups) for 1 full bottle of the same beverage for free You have $10 in your pocket. What is the maximum number of bottles of the beverage you can get? Solve this question by writing a function maxBeverageBottles. The function can be called as below: maxBeverageBottles(money, pricePerNewBottle, capsPerNewBottle, emptyBottlesPerNewBottle) which returns the maximum number of bottles you can get with money. money is the amount of money available; priceperNewBottle is the unit price for buying a new bottle; capsPer NewBottle is the number of caps needed for exchanging 1 free bottle; . emptyBottlesPerNewBottle is the number of empty bottles needed for exchanging 1 free bottle Then in the script file, store the result of calling maxBeverageBottles(10, 2, 4, 2) to maxBottlesi. What if you have $1000 in your pocket, the beverage still costs $2/bottle, but 5 caps/bottle or 3 empty bottles/bottle for exchanging a new free bottle, how many bottles can you get? Store the result to maxBottle. You may find floor and mod useful. Hint: For each new bottle you get, you have a new pair of cap and empty bottle (after con- sumed). So you can get new bottles until no enough money/caps/empty bottles

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!