#include <iostream>
#include <stdlib.h>
#include <stdio.h>
int main()
{
using namespace std;
//Some food items and all non-food items are subject to a statewide sales tax and local
//district taxes. Due to differences in district taxes, each store uses a different tax rate
char str_DelMar[] = "Del Mar", str_Encinitas[] = "Encinitas", str_LaJolla[] = "La Jolla";
//The above is the three districts
double tax_DelMar = 7.25, tax_Encinitas = 7.5, tax_LaJolla = 7.75, purchase = 125.00;
//The above is the distinct district taxes for the three districts
char s;
char mychar;
mychar = getchar();
//This is to ensure the user of this program knows what the purpose of this program is
cout << "This is a program to calculate the taxes on articles " << endl;
cout << "purchased at the price of $125, depending on the district. " << endl;
//The user needs to choose which option they want
cout << "For the district Del Mar, please press 1. " << endl;
cout << "For the district Encinitas, please press 2. " << endl;
cout << "For the district La Jolla, please press 3. " << endl;
//Added the option to exit for users
cout << "To exit, please press 0. " << endl;
for(;(s = getchar()) != '0';
//The following if / else statements calcualte the actual tax
//amount according to the district the user chooses
)if(s == '1')
cout << "The tax for the purchase at the price of $" << purchase << " in district "
<< str_DelMar << " is $" << purchase * tax_DelMar / 100 << endl;
else
if(s == '2')
cout << "The tax for the purchase at the price of $" << purchase << " in district "
<< str_Encinitas << " is $" << purchase * tax_Encinitas / 100 << endl;
else
if(s == '3')
cout << "The tax for the purchase at the price of $" << purchase << " in district "
<< str_LaJolla << " is $" << purchase * tax_LaJolla / 100 << endl;
return 0;
}
I have the start for converting it, but I am stuck!!
#include <stdlib.h>
#include <stdio.h>
main()
{
/*Some food items and all non-food items are subject to a statewide sales tax and local*/
/*district taxes. Due to differences in district taxes, each store uses a different tax rate*/
int iResponse = 0;
char str_DelMar[] = "Del Mar", str_Encinitas[] = "Encinitas", str_LaJolla[] = "La Jolla";
/*The above is the three districts*/
double tax_DelMar = 7.25, tax_Encinitas = 7.5, tax_LaJolla = 7.75, purchase = 125.00;
/*The above is the distinct district taxes for the three districts*/
char s;
char mychar;
mychar = getchar();
/*This is to ensure the user of this program knows what the purpose of this program is*/
printf("\nThis is a program to calculate the taxes on articles\n");
printf("\npurchased at the price of $125, depending on the district.\n");
/*The user needs to choose which option they want*/
printf("\nFor the district Del Mar, please press 1.\n");
printf("\nFor the district Encinitas, please press 2.\n");
printf("\nFor the district La Jolla, please press 3.\n");
/*Added the option to exit for users*/
printf("\nTo exit, please press 0.\n");
scanf(“%d”, &iResponse);
getch();
if (iResponse == 1)
printf("\nThe tax for the purchase at the price of $" << purchase << " in district "
<< str_DelMar << " is $" << purchase * tax_DelMar / 100 <<;
else
}
Any help will be appreciated!!
EDIT: Added code tags. ~Videege

New Topic/Question
Reply



MultiQuote






|