Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
Solved

# C++ Program to calculate the total sales values of a transaction

Posted on 2003-03-27
Medium Priority
1,005 Views
Write a C/C++ Program to calculate the total sales value of a transaction.  This program can be used in any of the 50 States of U.S.

I/p
# of items
Price of each item
sales tax % of your state
amount tendered

O/P
Total
Change Returned if any
0

Author Comment

ID: 8222658
This should be an easy program to write.
0

LVL 1

Expert Comment

ID: 8222850
#include<iostream.h>
void main()
{
int n;
float ppi,cost,amount,tax;
cout<<"Number of items";
cin>>n;
cout<<"Price of each item";
cin>>ppi;
cout<<"sales tax % of your state";
cin>>tax;
cout<<"Amount Paid";
cin>>amount;
cost=(1-tax/100)*(n*ppi);
if(cost>amount)
else if(cost==amount)
cout<<"You have paid the exact amount";
else
cout<<"Here's the change  "<<amount-cost;

}
0

LVL 1

Expert Comment

ID: 8222868
#include<iostream.h>
void main()
{
int n;
float ppi,cost,amount,tax;
cout<<"Number of items";
cin>>n;
cout<<"Price of each item";
cin>>ppi;
cout<<"sales tax % of your state";
cin>>tax;
cout<<"Amount Paid";
cin>>amount;
cost=(1-tax/100)*(n*ppi);
if(cost>amount)
else if(cost==amount)
cout<<"You have paid the exact amount";
else
cout<<"Here's the change  "<<amount-cost;

}
0

LVL 30

Expert Comment

ID: 8223220
>> Write a C/C++ Program to calculate the total sales value of a transaction

We are not sitting here without any work just to do your assignments and home-work for you. Try to work out some code on your own and if you face errors, etc then ask us. We can give you hints as to how to proceed, but not the entire program.

>> This should be an easy program to write.

If so, then you can try it once on your own and see....

However, I see that somebody has been kind enough to you to give a entire code, but I hope that you don't expect this from everyone, everytime you post a question.

Mayank.
0

LVL 9

Expert Comment

ID: 9551089
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

PAQ/No Refund (Homework)

Tinchos
EE Cleanup Volunteer
0

LVL 1

Accepted Solution

Computer101 earned 0 total points
ID: 9594658
PAQed - no points refunded (of 75)

Computer101
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generatâ€¦
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilationâ€¦
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
###### Suggested Courses
Course of the Month10 days, 10 hours left to enroll