The government has decided to charge 0.5% tax on every car purchased from the Ghana car company. Write a program to
a. Request for user name and password. The username and password should grant access to the program if correct.
b. A function that calculates and display tax on any car purchased.
c. The program should be able to perform “b” above at least 10 times.
d. Assuming sales have now him up and the government has scraped the tax incentive. A tax if 25% now imposed on each car sale. Modify a portion of the code to reflect the new development.
e. Explain how the Ghana Revenue Agency can use your program to calculate tax on goods imported into the country.
#include <iostream>
double tax(double price)
{
return price * 0.005;
}
double new_tax(double price)
{
return price * 0.25;
}
int main()
{
std::string name, password;
std::cout << "Enter your name: ";
std::cin >> name;
std::cout << "Enter your password: ";
std::cin >> password;
double taxes = 0.0;
for (std::size_t i = 0; i < 10; ++i)
{
double price = rand();
taxes += tax(price);
}
double new_taxes = 0.0;
for (std::size_t i = 0; i < 10; ++i)
{
double price = rand();
new_taxes += new_tax(price);
}
std::cout << "Tax 0.5% from 10 purchases will bring about: " << taxes << std::endl;
std::cout << "Tax 25% from 10 purchases will bring about: " << new_taxes << std::endl;
//this will bring the ability to agency to compare the taxes on goods imported.
return 0;
}
Comments
Leave a comment