Create a structure named Purchase. Each Purchase contains an invoice number, amount of sale, and amount of sales tax. Create a main() function that declares a Purchase variable and prompts the user for purchase details. When you prompt for an invoice number, do not let the user proceed until a number between 1000 and 8000 has been entered. When you prompt for a sales amount, do not proceed until the user has entered non-negative value. Compute the sales tax as 5 percent of the purchase price. After a valid Purchase variable has been created, display the variable’s invoice number, sale amount and sales tax.
1
Expert's answer
2011-07-05T07:35:19-0400
#include <iostream> using std::cout; using std::cin; using std::endl;
struct Purchase { int invoiceNum; float saleAmount; float tax; };
int main () { Purchase purchase; do { & cout<< "Enter invoice number (between 1000 and 8000)"<< endl<< "> "; & cin >> purchase.invoiceNum; } while(purchase.invoiceNum < 1000 || purchase.invoiceNum > 8000); do { & cout<< "Enter sale amount (non-negative value)"<< endl<< "> "; & cin >> purchase.saleAmount; } while (purchase.saleAmount < 0);
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment