![]() |
|
#1
|
|||
|
|||
[C++]Structures and ClassesMachine Problem 3 (MP3.cpp)
Budgets Write a program that maintains a Household budget and it has 3 budget items: food, rent, and cell phone. The following struct identifies what is in each record: CPP / C++ / C Code:
Write a program that allows the user to review a budget item, add a new item, record an expense, change the budgeted amount of an item, print a report, or quit. The name of the budget is to be used in your output labels. When the user requests to review a budget item, display the list of budget items and allow the user to select which item they want to review. Once the user makes their selection, simply print the information about that budget item to the screen. Include the name, amount allocated, amount used, date of last expense, and amount remaining. When the user wants to add a budget item, gather the name and amount budgeted from the user. Set the amount used to 0 and the date to 0 0, 0 and add the record at the end of the record. Also add the name to the list of names you are storing in the program. There is a maximum of 100 budget items. If the user wants to add another item when there are already 100, print a message and do not allow it to be added. To record an expense, the user needs to select which item the expense is for. Then the user needs to enter the amount of the expense. If the new expense would put the total used over the budgeted amount for that item, ask the user if they really want to add the expense. If they indicate they want to add the expense even though it puts them over budget, go ahead and add it. If they decide not to add it, make no change. To add the expense, increase the amount used and get the date of the expense. Validate that the month is between1-12, the day is a valid day for that month (you do not need to worry about leap year. For month 2 simply validate that the day is from 1-28.) Make sure the year is in this century. After the input has been validated, the program is to update that individual record. When the user requests to change the budgeted amount, display the list of budget items and allow the user to select which item they want to change. Display the information about this item and let the user enter the new budget amount. When the user wants a report printed display a table with labels at the top and a row for each budget item. Include the name, amount budgeted, amount used, and amount remaining for each item. Remember to only store one item in the program at a time. When the user selects quit, shut down the program. Last edited by LuciWiz : 27-Jul-2005 at 07:52.
Reason: Please insert your C++ code between [c++] & [/c++] tags
|
|||
|
#2
|
||||
|
||||
|
Are you giving us homework?!?
Matthew |
|
#3
|
||||
|
||||
|
Hello,
Please insert your C++ code between [.c++] & [./c++] tags. Hope u seen that edited reason tag at the bottom [.c] codes to be places here... [./c] w/o the full stop... once again post what u have done. at least e basic stuff. ppl normally dont mind to edit codes and add in a few functions totally free for you, but not the entire program __________________
People should read the rules and regulation before posting! The Best is yet to be... |
|
#4
|
|||
|
|||
mind ur own business matthersory I wasn't able to post what I had done coz it took me a whole day to figure this machine problem here's what I have accomplish so far..
CPP / C++ / C Code:
did I do this right? P.S. I would appreciate if only people who are interested to program view my post to critics, please bear with me as I said Im only a beginner If you still couldn't contain yourselves go find some other program to criticize get my drift? Last edited by LuciWiz : 30-Jul-2005 at 07:29.
Reason: Please insert your C++ code between [c++] & [/c++] tags
|
|
#5
|
||||
|
||||
|
Quote:
As for the note to your critics, I find this a rude request since you can't be bothered to do as requested. Code tags help us read your code -- it's unreadable as is. The Guidelines help you ask good questions... Get my drift? Please read the guidelines and refrain from sniping at us. __________________
Cow: You're a lawyer too? Mooseblood (mosquito): Ma'am, I was already a bloodsucking parasite. All I needed was a briefcase! |
|
#6
|
||||
|
||||
|
Hmm maybe he doesnt know how to include those tags ?
Red, can you type -->[.c] (without the dot) and [./c] (without e dot) first before inserting your code ? so it woud be like: [.c] #include <iostream> //your code here. [./c] it would change your code into something more readable and colorful __________________
People should read the rules and regulation before posting! The Best is yet to be... |
|
#7
|
|||
|
|||
sorry I'll always remember the format from now onCPP / C++ / C Code:
I was not talking about you people who are helping me it's just that you have some members who are rude, this forum is created in order to help people who have problems in creating programs in C++ is it not? |
|
#8
|
||||
|
||||
|
at least thats better, but what problems are you having with that program?
To kick start things, i would say that you used too much if else statements. i suggest u use a switch statement to make your program easier to managed, and less bugs. eg: CPP / C++ / C Code:
__________________
People should read the rules and regulation before posting! The Best is yet to be... |
|
#9
|
||||
|
||||
|
Red, you still need to deal with your code formatting style a bit. This can be a personal topic and you just kind of need to find one that suits you. Then stick to it. When you look at Acedo's snip of code don't you find it easier to follow?
Consider the two versions of your code here, CPP / C++ / C Code:
This makes it very difficult for someone to follow your logic (and find silly typos) then something along the lines of, CPP / C++ / C Code:
Now when I look at it, I get a better sense of what is happening. That is the style like to use, many others like to do something like, CPP / C++ / C Code:
They accomplish the same thing though. You can find some opinions on the matter in this thread and this thread here at GIDForums™ or many, many other places using a Google search. The best thing though, just find something readable that you are comfortable with and stick with it. Troubleshooting will become infinitely easier. Your code compiles giving me only the warning, Code:
In the (formatted) code it refers to this line, CPP / C++ / C Code:
When I run it I find it very difficult to tell just what you want me to enter. You need to clarify your inputs a bit. As for this last bit, Quote:
Yes it is for learning. Yes, you might perceive some people to be rude. What you have to take into consideration is that,
If you think this is rude, well, I don't know what to say. Try out some of the forums with members that come in with a flamethrower all ready to go. I don't think that is the case here. If you ask for help and follow some very simple rules we have, everyone (not just you) can benefit. Mark __________________
"Opportunity is missed by most people because it comes dressed in overalls and looks like work." --Thomas Alva Edison "Those who would give up essential liberty to purchase a little temporary safety, deserve neither liberty nor safety." --Benjamin Franklin "A happy person is not a person in a certain set of circumstances, but rather a person with a certain set of attitudes." --Hugh Downs |
|
#10
|
||||
|
||||
|
Yeap,
Quote:
like for that, line 21 refers to 3 different thing, isit x or i or z that is giving the problems. same goes for other bugs that could be found oso when pointed out by the debugger. easier if there is only a complete sentence for each line of code. __________________
People should read the rules and regulation before posting! The Best is yet to be... |
Recent GIDBlog
New Corolla Altis, 10th Generation - Part I by Nihal
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Assistance with classes... | Bravebird | CPP / C++ Forum | 7 | 27-Apr-2005 13:17 |
| Help using const arrays in c++ classes | FlipNode | CPP / C++ Forum | 5 | 31-Mar-2005 01:16 |
| Fairly simple classes help please | sammacs | CPP / C++ Forum | 0 | 30-Nov-2004 09:58 |
| Using map<> with classes | crystalattice | CPP / C++ Forum | 3 | 14-Nov-2004 16:23 |
| ClassView not showing my classes (VC++, namespace, headers) ?!?!? | djovanov | CPP / C++ Forum | 1 | 13-Jan-2004 04:54 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The