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
6
Medium Priority
?
1,005 Views
Last Modified: 2006-11-17
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
Comment
Question by:devinsdad
6 Comments
 

Author Comment

by:devinsdad
ID: 8222658
This should be an easy program to write.
0
 
LVL 1

Expert Comment

by:vamshi_pavan
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)
          cout<<"Please pay  "<<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

by:vamshi_pavan
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)
          cout<<"Please pay  "<<cost-amount;
     else if(cost==amount)
          cout<<"You have paid the exact amount";
     else
          cout<<"Here's the change  "<<amount-cost;

}
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 30

Expert Comment

by:Mayank S
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

by:tinchos
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)

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Tinchos
EE Cleanup Volunteer
0
 
LVL 1

Accepted Solution

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

Computer101
E-E Admin
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

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

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question