?
Solved

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

Posted on 2003-03-27
6
Medium Priority
?
946 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
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.

770 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