Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Not sure how to do this... (http://www.go4expert.com/forums/not-sure-how-to-do-this-t24865/)

Naitryn 6Feb2011 05:23

Not sure how to do this...
 
I've done some C++ programming work but never one like this so I'm a little unsure of what to do. Here's the problem:

Marcy's Department store is having a BoGoHo. The store manager wants a program that allows the salesclerk to enter the prices of two items. The program should both calculate and display the total amount the customer owes. The half off should always be taken on the item having the lowest price.


I don't exactly know how to get it to calculate and take the half price off the lesser item. How exactly am I supposed to do this?

Umairajmal 6Feb2011 11:28

Re: Not sure how to do this...
 
Post your code then we can help.

xpi0t0s 6Feb2011 14:45

Re: Not sure how to do this...
 
How would you do it on paper? That's always a good way to start figuring out how to do it. Take a few examples and work them out, and after you've done a few you should start getting the hang of it and be able to determine a step by step approach. Let's say the two items are $100 and $50, so the price is $100+half of $50 which is $125. Or maybe the items are $10 and $20, in which case the cost is $20+half of $10 which is $25. What is the cost of two items $50 and $60?

Don't be afraid to create new variables. If the items are in item1 and item2, you might want to create intermediate variables costL and costH.


All times are GMT +5.5. The time now is 00:43.