![]() |
| ||
| Vending Machine 1 Attachment(s) Yes i know everyone hates homework help but this was a last place i could go I am writing a program that stimulates a vending machine and i have written almost all of the code its just not working correctly I am stressing out because it is due by tomorrow and was wondering if anyone would be able to help me out in any way possible i have attached the *.cpp file and would be willing to do anything if someone would look over it Im not asking for you to completly due it just help me becase i am stuck and do not know were to turn. In the program it is to give change back which i am having trouble doing so because it breaks it down into half dollars dollars dimes quarters and nickles its really the only problem i have i have written code that i believed to work but it has not if anyone is out there please help This is what the outcome should look like http://www.cs.ua.edu/114/Summer2004/Programs/prog2.htm |
| ||
| Re: Vending Machine Gee, you sure were in a hurry but the lack of full stops really mangles what you say. This is not really a place to ask for homework answers.But I did look at your code and you use a lot of variables like a,b,c etc for what resonable puprose I cant guess.Also code is a bit messed up in the sense that it too packed where you calculate the vals so I could not understant it too much either. But here's something : Lesson1:Code clearly and use spaces and newlines.They will save your life when it comes to debugging.Noodle code is a death trap.(Your code is not too noodlely except in the if else part). Lesson 2:Use funtions (I dont know if you know funtions) Now your prob:One Idea would be to convert the entire amount in to the lowest denomintions availble(nickle?) and calulate using that.In the end convert it back to dollars and show what ever remanins as nickles.Dont bother with quaters unless you have to. Not much but i could not understand you code nor what was you prob,nor do i have a compiler handy right now. :0 |
| ||
| Re: Vending Machine I'm writing your program though it might be too late! ;) |
| ||
| Re: Vending Machine ok... it's ready but it doesn't cover the part where the option is invalid ;) #include <iostream.h>:cheesy: |
| ||
| Re: Vending Machine Quite nice,Fili |
| ||
| Re: Vending Machine Thanks Fire Net :D Do you suppose it's too late for it to be of any use? |
| ||
| Re: Vending Machine I dont think so,it will be of some use to someone,hey teachers usally accept a submission even if it a bit late. |
| ||
| Re: Vending Machine Quote:
|
| ||
| Re: Vending Machine I'm not expert but I did programming in my 2 year course just finished and understood that vending machines work on the weight of coins. :rolleyes: |
| ||
| Re: Vending Machine Quote:
|
| ||
| Re: Vending Machine |
| ||
| Re: Vending Machine ahh ok I see. Thanks Dave :) |
| All times are GMT -4. The time now is 12:39 pm. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC