| | |
Urgent Porgramming help needed
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Sep 2006
Posts: 1
Reputation:
Solved Threads: 0
I have to write this program by 12 a.m. tonight and i need help writing this program below. I will work with whoever can give me help all night if that is what it takes
I'm trying to write a small code that will ask the user to choose between Orange county or Seminole county sales tax calculation.
- The user will also have the option to quit the program. (You can use 1, 2, and 3 respectively).
- If the incorrect choice is typed, display an error message and prompt the user to re-enter a choice.
- If the user selects one of the two counties, the program should prompt the user to enter the price of the item.
- The program must then calculate the sales tax according to the following:
- Orange county tax is 6.5%.
- Seminole county tax is 7.0%.
- Finally, the program must output the price, tax, and total amount.
- The process must continue until the user enters the option to quit the program.
Here is a bit of my code but i don't know what to do next:
am i off to the right start or what?
CODE:
I'm trying to write a small code that will ask the user to choose between Orange county or Seminole county sales tax calculation.
- The user will also have the option to quit the program. (You can use 1, 2, and 3 respectively).
- If the incorrect choice is typed, display an error message and prompt the user to re-enter a choice.
- If the user selects one of the two counties, the program should prompt the user to enter the price of the item.
- The program must then calculate the sales tax according to the following:
- Orange county tax is 6.5%.
- Seminole county tax is 7.0%.
- Finally, the program must output the price, tax, and total amount.
- The process must continue until the user enters the option to quit the program.
Here is a bit of my code but i don't know what to do next:
am i off to the right start or what?
CODE:
C++ Syntax (Toggle Plain Text)
using namespace std; int main() { bool done; int num1; int num2; int userChoice; bool finished; do { cout << "Enter <1> if you want to start over "; cin >> userChoice; if (userChoice == 1) { finished = true; } else { finished = false; } } done = false; cout << " Enter Orange county or Seminole county "; while (done == false) { cin >> num1; cin >> num2; done = false; cout << " Incorrect. Please try again. "; } } while (finished == false); return 0;
Last edited by WolfPack; Sep 22nd, 2006 at 9:44 am. Reason: Added [CODE][/CODE] tags
•
•
Join Date: Jun 2006
Posts: 25
Reputation:
Solved Threads: 1
In the prompt for user starting over, your
Shouldn't you put the whole program in a while loop, with
Your do ends with the curly brace above
also, your prompt for the counties inputs the numbers, but then assumes that they entered something incorrectly, so it will never do anything but keep prompting for numbers saying you gave it something incorrect.
I hope this stimulates your figuring out process, because I don't want to tell you how to program, but I can give you a start in the right direction.
bool finished is assigned true if they want to continue. Although this works, you might consider renaming it to bool continue, just for clarity's sake.Shouldn't you put the whole program in a while loop, with
(finished == true) as the condition, then at the end of the loop prompt for bool finished? Because the way you have it right now makes the prompt happen indefinately (in what appears to be an infinite loop), then you have a loop for the counties, without the prompt to continue.Your do ends with the curly brace above
done=false;, but the while that you want at the end is not at the end of do, but at the end of the program.also, your prompt for the counties inputs the numbers, but then assumes that they entered something incorrectly, so it will never do anything but keep prompting for numbers saying you gave it something incorrect.
I hope this stimulates your figuring out process, because I don't want to tell you how to program, but I can give you a start in the right direction.
Last edited by FireSBurnsmuP; Sep 22nd, 2006 at 2:47 pm. Reason: I missed something
![]() |
Similar Threads
- URGENT!! - Constructive Criticism needed on www.giftday.co.za (Website Reviews)
Other Threads in the C++ Forum
- Previous Thread: Was C++ help for standard deviation (bumped)
- Next Thread: External queue struct using queue.c
| Thread Tools | Search this Thread |
api array based beginner binary bitmap c++ c/c++ calculator char class classes code coding compile compiler console conversion count database delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream int integer java lib linkedlist linker linux list loop looping loops map math matrix memory multiple news node number output parameter pointer problem program programming project python read recursion recursive reference return rpg string strings struct temperature template templates test text text-file tree unix url variable vector visualstudio win32 windows winsock word wordfrequency wxwidgets





