Hello i am writing a program and i really need help. here is what the program is about.
1. It needs to ask a number of tickets sold.
2. persantage which goes to some other coast. This input will be entered in percent format. program must convert this to a decimal fraction, like 20% should be .20 and so on.
3. Total amount of prize money distributed.
4. Name of the avent.

The out put should be somthing like this.

1. Name of charity
2. Total revenue generated from the ticket sales. The price of each ticket is currently fixed at $5.00.
3. Total amount of administrative overhead.
4. Total amount of prize money overhead.
5. Balance remaining for the charitable fund.
My code is below:

#include <iostream>
#include <string>
using namespace std;

int main ()

{
const int price=5;
string name;
int total_money, total_price;tickets, percentage;
cout<<"Enter the amount of tickets sold."<<endl;
cin>>tickets;
cout<<"What percentage of the ticket revenue goes to administrative costs?"<<endl;
cin>>percentage;
cout<<"How much total money is distributed in prizes?"<<endl;
cin>>total_money;
cout<<"What is the name of the charity?"<<endl;
getline(cin name);
cout<<"Charity:"<<name<<endl;
can somebody help me finish this please.

Recommended Answers

All 3 Replies

>can somebody help me finish this please.
You've barely done anything. Work out what calculations you want to do on paper before trying the code. That way you have a good idea of what needs to be done. As it is, I get the impression that you have no idea how to solve the problem.

Hi,

I agree with Narue.

You also forgot error checking on your numeric inputs. what happens if a person enters in a negative ticket price?

Christian

>can somebody help me finish this please.
You've barely done anything. Work out what calculations you want to do on paper before trying the code. That way you have a good idea of what needs to be done. As it is, I get the impression that you have no idea how to solve the problem.

ok here is the sample run.
How many tickets were sold? 50000
What percentage of the ticket revenue goes to administrative costs? 2
How much total money is distributed in prizes? 15000
What is the name of the charity? Good Intentions

Charity: "Good Intentions"
Revenue generated from ticket sales: $ 250000.00
Amount deducted for administrative overhead: $ 5000.00
Amount deducted for prize money: $ 15000.00
Balance raised for charitable fund: $ 230000.00

My code.

#include <iostream>
#include <string>
using namespace std;


int main ()

{
	const float ticketPrice=5.00;
	float totalPriceMoney, totalAdministrativePercent, totalAward;
	int numberOftickets;
	string charityName;
	cout << " How many tickets were sold?"<<endl;
	cin>>numberOftickets;
	cout<<"What percentage of the ticket revenue goes to administrative costs?"<<endl;
	cin>>totalAdministrativePercent;
	cout<<"How much total money is distributed in prizes?"<<endl;
	cin>>totalPriceMoney;
	totalPriceMoney=15000;
	cin.ignore();
	cout<< "What is the name of the charity?"<<endl;
	getline(cin, charityName);
	cout<<"Charity:"<<charityName<<endl;
	cout<<"Revenue generated from ticket sales:"<<numberOftickets*ticketPrice<<endl;
	cout<<"Amount deducted for administrative overhead:"<<totalAdministrativePercent*totalPriceMoney/100<<endl;
	cout<<"Amount deducted for prize money:"<<totalPriceMoney<<endl;
	cout<<"Balance raised for charitable fund:"<<numberOftickets*ticketPrice-totalAdministrativePercent*totalPriceMoney/100-totalPriceMoney;
	
	return 0;
}

but with my code some of the numbers don't add up to a sample run. can you help? please


<< moderator edit: added code tags: [code][/code] tags >>

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.