Question

Looking for code in MATLAB:

A store owner asks you to write a program for use in the checkout process. The program should: Prompt the user to enter the cost of the first item Continue to prompt for additional items, until the user enters 0 Display the total. Prompt for the dollar amount the customer submits as payment. Display the change due.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

sum = 0.0;
cost = input("Enter the cost of item: ");
while cost !=0
sum = sum + cost;
cost = input("\nEnter the cost another item: ");
end

fprintf("\nYour total is: %f", sum);

payment = input("\nPlease submit the payment: $");

if payment >sum
fprintf("\nChange due: %f", payment-sum);
elseif payment==sum
fprintf("No Change Due");
end


========================================================================
See Output
sum0.0; 2 costinput(Enter the cost of item: ); 3 while cost !-0 4 sumsum+cost 5 costinputC \nEnter the cost another item:

OUTPUT Screen, Input were provided


Thanks, let me know if there is any doubts/concern.

Add a comment
Know the answer?
Add Answer to:
Looking for code in MATLAB: A store owner asks you to write a program for use...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT