|
Post by Darin on Jun 10, 2013 9:05:41 GMT -5
As the title suggests, this is just a thread for me to share small little things I am doing programming wise with C++. So right now, I have created a VERY basic and simple little program that asks you to input the "Number of citizens", it then multiplies that number by by 5, and the result is "your tax income for this month". As you can see I am wording it to fit with either DomiNation, or BoP. Now the next step I am working on is creating one where you can input both the "Number of citizens" and the number its multiplied by. That is the very basic form of "setting taxes". Once I get THAT one done, I will take the NEXT step, and try to create a program that will be more useful, where you can set a certain percentage for taxes, and also where it can average out the citizens income and come up with a more realistic system for determining a "players" monthly income. I may eventually get to the point where this "string" of programs could actually help William out with BoP. Something along the lines of a program where you just input a players information, and it will spit out the results for you (doing all the math/calculations for you). Anyway, if anyone is interested I can post the actual code for the first program that I actually have done.
|
|
|
Post by Darin on Jun 10, 2013 11:42:23 GMT -5
HUZZAH!
I have just figured out how to do the next step of being able to input both the number of citizens AND the amount of taxes (its still citizens multiplied by taxes, still got to work on this part).
|
|
|
Post by Syreth on Jun 10, 2013 12:03:00 GMT -5
Code please
|
|
|
Post by Darin on Jun 10, 2013 12:14:44 GMT -5
Most basic version: Latest version: Also heads up on both of these. The command 'system("pause");' only works if you are running Windows (it should work with any version). The reason this command is even in there is because when you compile code into an actual application, it will close the program before you even get a chance to see what it says (or with these since they require input, once you have input all the required information, it will close so fast you won't be able to actually see the results), so the 'system("pause");' command displays a "Press any key to continue..." and it won't close down the window till you press a key.
|
|
|
Post by Syreth on Jun 10, 2013 12:19:13 GMT -5
Fancifull
|
|
|
Post by Darin on Jun 10, 2013 12:20:51 GMT -5
Haha, this is actually all just VERY basic code, and I am actually probably using a more round about way to do some of the things. Not so much a round about way of doing things with these two programs, but with the next version that I am going to attempt to make, these methods will be more round about then what is possible, but I am still learning the more fancy ways of doing it, so I am sticking to these (and a few more I haven't actually coded yet) ways of doing things. But you only get better with practice.
|
|
|
Post by Syreth on Jun 10, 2013 12:23:40 GMT -5
What the hell is a cout tag.
|
|
|
Post by Darin on Jun 10, 2013 12:30:47 GMT -5
"The part enclosed within the double quotation marks is the message to print. In C++, any series of characters enclosed in double quotation marks is called a character string, presumably because it consists of several characters strung together into a larger unit. The << notation indicates that the statement is sending the string to cout; ..." "And what is cout? It's a predefined object that knows how to display a variety of things, including strings, numbers, and individual characters." That's the best definition for it I could find in mah book at short notice. I will try to find out more for you. Edit: Some more "Listing 2.1 uses the C++ cout facility to produce character output."
|
|
|
Post by Syreth on Jun 10, 2013 12:37:01 GMT -5
K, ty
|
|
|
Post by Darin on Jun 11, 2013 12:45:06 GMT -5
NAILED IT! OK so maybe not EXACTLY what I had in mind. My newest version of the program goes through the following steps; Input your tax paying population Input your monthly tax rate Input the average income of your tax paying population The program then uses a place holder that = your population divided by the average income (This is the main part I am not happy with, I need to come up with a better way of doing this and a better overall equation) Next the program multiplies the place holder by the tax rate and that result = your monthly income Like I said its not REALLY what I wanted, but the fact I figured out how to make the above program and everything works perfectly every time, I am happy. Next I am going to find out a better equation (and a way to implement it), for figuring out a players monthly income based on there population, tax rate, and average income of said population. Anyway, BACK TO WORK!
|
|
|
Post by Darin on Jun 11, 2013 13:27:22 GMT -5
HELL YEAH!!!!!!!!!!!!!!!!!!!!!!!!!! I actually have a functional program with a legitimate use!!!!! Here's how it goes: Input rich bracket average income Input middle bracket average income Input poor bracket average income Shows average income Input the total population Input the tax rate (also by "tax rate" I am basically saying what % of someone income is paid in taxes) Shows monthly income And it works like a freaking charm!!! Here are the results with the following input: Rich average = 500 Middle average = 250 Poor average = 50 Total average income = 266 Total population = 10,000 Tax rate is 20% Monthly income = 133,000 Now my next idea is to make a program where you input the population based on income bracket, then input the average income for each bracket, THEN run the match of taxes, monthly income, etc. My only question is, would that be a better more accurate program then the one I already have?
|
|
|
Post by Varangian on Jun 11, 2013 13:36:23 GMT -5
I say you make population count and tax brackets for Rich, Middle and Poor each, so that it shows the exact amounts of everything.
|
|
|
Post by Darin on Jun 11, 2013 14:25:27 GMT -5
Yeah, I am going to make a program that does all the calculations that this version does, but devide it into each income bracket. Which by the way will be named High, Middle, and Low instead of the Rich, Middle, and Poor. Its more accurate and broad. I mean, the "Low" income could still be wealthy, so just because its the lowest bracket doesn't mean its "poor", so I figure the new names will be better.
|
|
|
Post by Darin on Jun 11, 2013 15:28:16 GMT -5
Alright, just made the newest version, and it calculates the taxes for each bracket individually, and I think it shows a far more accurate number of what the taxes would be with the data I input. Funnily enough, when I put the same data for the average income per bracket and the total population into the previous version, the tax income is 133,000, while with the new program, since it also requires you to input the population of each bracket, I get a tax income of only 87,500, even though the total population is the same. The new version is more accurate because the population is divided between brackets, which is the main reason the previous version has a different tax income, cause its more general and not a precise. Also kind of odd, the average income, using the NEWEST version, is 766... I think I did something wrong... FIXED IT!!! The average income in the country is now 254. Which is accurate.
|
|
|
Post by cleverconure on Jul 31, 2015 22:23:37 GMT -5
Nice! In C#, I made a program with a bunch of homework study-guide questions on it, with answers assigned to each one. When you run the program, it will ask you one of the following questions, and you have to answer it by typing either A, B, C, or D (Multiple choice). If its right, it will move on and say its correct. If its wrong, it will move on but say that its wrong.
Thats the best I've done lol. Keep up the good work.
|
|