Program Help Urgent Help needed

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 ios 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:

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;
[1717 byte] By [skywalker112] at [2007-11-20 1:34:57]
# 1 Re: Program Help Urgent Help needed
What is the use of variable done? Do something like this

bool finished = false;
do
{
//get choice
switch(choice)
{
case 1 :
finished = true;
break;
case 2 :
// Orange stuff
break;
case 3 :
// Seminole stuff
break;
default :
//print error
}

}while(finished == false);
kumaresh_ana at 2007-11-10 23:17:59 >
# 2 Re: Program Help Urgent Help needed
Try this:using namespace std;
int main()
{
while (1)
{
cout << "Enter '1' to quit this program\n";
cout << "Enter '2' to calculate Orange County tax\n";
cout << "Enter '3' to calculate Seminole County tax\n";

char userChoice;
cin >> userChoice;

if (userChoice == '1')
break;

float taxRate, purchase;

if (userChoice == '2')
taxRate = 0.06;
else if (userChoice == '3')
taxRate = 0.075;
else
{
cout << "Invalid option, please try again.\n";
continue;
}

cout << "Enter purchase amount: ";
cin >> purchase;

float tax = purchase * taxRate;
CString report;

report.Format("Purchase price: %.2f\nSales Tax: %.2f\nTotal: %.2f\n\n",
purchase, tax, purchase + tax);

cout << report;
}

return 0;There may be some truncation errors in the tax calculation, but you can use some kind of rounding function, or you can test the values yourself and round up or down.
yooper at 2007-11-10 23:18:55 >
# 3 Re: Program Help Urgent Help needed
Isn't the clue of homework that you have to do it yourself ?? ;)
Skizmo at 2007-11-10 23:19:59 >
# 4 Re: Program Help Urgent Help needed
The loop:
while (done == false)
{
cin >> num1;
cin >> num2;

done = false;
cout << " Incorrect. Please try again. ";
}
Never exits. You never set 'done' to anything but false.

Viggy
MrViggy at 2007-11-10 23:21:04 >