Hi everyone, i would like to use your help from my programming c++ assignmnet. am trying to do it, and i have to do this assignment because its my last hope to pass the course, because my dr. told me if i didnt do it correctly i will fail so please help me. i will post what the dr. wants and please please try to help me.
Thank you for ur time though
Objectives
1. Learn how to read in data from file.
2. Learn how to use arrays in conjunction with loops to solve standard data analysis problems.
Problem1: Donation Analysis
Money makes a difference in elections. With more money, a campaign can run more ads and hire more staff, giving the campaign an edge.
Due to your skills in programming, your boss has asked you to write a C++ program that helps in analyzing the recent campaign donations.
In particular, you will write a program that reads in information about these donations from a file. After reading in that data into your program, your program will provide the user with the following menu options:
1) Calculate the average donation for a subset of the donations.
2) Calculate the minimum donation for a subset of the donations.
3) Calculate the maximum donation for a subset of the donations.
4) Calculate the number of donations exceeding certain value.
5) Calculate the number of donations of a particular value.
6) Calculate what percentage of the donations are under certain value.
7) Quit
Your program should allow the user to continue choosing these options and execute them until the user quits. (Note: The entire time the program is running, it will be making these queries on the same set of data that was originally read it at the beginning of the program.)
Input File Specification
The first line of the input file will contain a single positive integer, n, which is less than or equal to 100000. This specifies the number of donations stored in the file. Each donation follows, one per line. Each individual donation will be a positive integer less than or equal to 2300.
Output Specification
At the very beginning of your program, you should prompt the user for their input file.
Once that is read in, your program should print out a message with the following format:
The data for n number of contributions has been read.
where n represents the total number of donations read from the file. These donations are numbered from 0 to n - 1.
Here is what your program should do for each of the following options:
#1) Prompt the user for the low bound for the subset of donations and the high bound for the subset of donations (you have to make sure that the user enters valid numbers, for this case and each of the following cases). Then produce an output message with the following format:
The average donation from person A to person B is X
where A is the low bound entered by the user, B is the high bound entered by the user and X represents the dollar amount (rounded to two decimal places) of the average donation by the group of people from person A to person B, inclusive.
#2) Prompt the user for the low bound for the subset of donations and the high bound for the subset of donations. Then produce an output message with the following format:
The smallest donation from person A to person B is X.
where A is the low bound entered by the user, B is the high bound entered by the user and X represents the amount of the minimum donation by the group of people from person A to person B, inclusive.
#3) Prompt the user for the low bound for the subset of donations and the high bound for the subset of donation. Then produce an output message with the following format:
The largest donation from person A to person B is X.
where A is the low bound entered by the user, B is the high bound entered by the user and X represents the dollar amount of the maximum donation by the group of people from person A to person B, inclusive.
#4) Prompt the user to enter a target value and then print out a message with the following format:
X people donated more than Y.
where X represents the total number of donations (from the whole file) that exceed Y dollars. (Note: Y is the value entered by the user.)
#5) Prompt the user to enter a target value and then print out a message with the following format:
X people donated exactly Y.
where X represents the total number of donations (from the whole file) that equal Y dollars. (Note: Y is the value entered by the user.)
#6) Prompt the user to enter a target value and then print out a message with the following format:
Donations under Y accounted for XX percent of the total funds raised.
where XX represents the percentage of the total donations (value-wise) rounded to two decimal places from donations under Y dollars.
Output Sample
Below is one sample output of running the program. Note that this sample is NOT a comprehensive test. You should test your program with different data than is shown here based on the specifications given above. In the sample run below, for clarity and ease of reading, the user input is given in italics while the program output is in bold.
The following file, "sample.txt", is used for the sample below.
sample.txt
10
50
25
75
2000
30
500
800
10
25
485
Sample Run
Please enter the name of the data file.
sample.txt
The data for 10 number of contributions has been read.
Please make a choice from the following options:
1) Calculate the average donation for a subset of the donations.
2) Calculate the minimum donation for a subset of the donations.
3) Calculate the maximum donation for a subset of the donations.
4) Calculate the number of donations exceeding a target value.
5) Calculate the number of donations of a particular dollar amount.
6) Calculate what percentage of the donations (value wise) are under a target value.
7) Quit
1
What is the low bound for your group (0-9)?
3
What is the high bound for your group (0-9)?
6
The average donation from person 3 to person 6 is $832.50.
Please make a choice from the following options:
1) Calculate the average donation for a subset of the donations.
2) Calculate the minimum donation for a subset of the donations.
3) Calculate the maximum donation for a subset of the donations.
4) Calculate the number of donations exceeding a target value.
5) Calculate the number of donations of a particular dollar amount.
6) Calculate what percentage of the donations (value wise) are under a target value.
7) Quit
2
What is the low bound for your group (0-9)?
3
What is the high bound for your group (0-9)?
6
The smallest donation from person 3 to person 6 is $30.
Please make a choice from the following options:
1) Calculate the average donation for a subset of the donations.
2) Calculate the minimum donation for a subset of the donations.
3) Calculate the maximum donation for a subset of the donations.
4) Calculate the number of donations exceeding a target value.
5) Calculate the number of donations of a particular dollar amount.
6) Calculate what percentage of the donations (value wise) are under a target value.
7) Quit
3
What is the low bound for your group (0-9)?
3
What is the high bound for your group (0-9)?
6
The largest donation from person 3 to person 6 is $2000.
Please make a choice from the following options:
1) Calculate the average donation for a subset of the donations.
2) Calculate the minimum donation for a subset of the donations.
3) Calculate the maximum donation for a subset of the donations.
4) Calculate the number of donations exceeding a target value.
5) Calculate the number of donations of a particular dollar amount.
6) Calculate what percentage of the donations (value wise) are under a target value.
7) Quit
4
What is the target donation?
75
4 people donated more than $75.
Please make a choice from the following options:
1) Calculate the average donation for a subset of the donations.
2) Calculate the minimum donation for a subset of the donations.
3) Calculate the maximum donation for a subset of the donations.
4) Calculate the number of donations exceeding a target value.
5) Calculate the number of donations of a particular dollar amount.
6) Calculate what percentage of the donations (value wise) are under a target value.
7) Quit
5
What is the target donation?
25
2 people donated exactly $25.
Please make a choice from the following options:
1) Calculate the average donation for a subset of the donations.
2) Calculate the minimum donation for a subset of the donations.
3) Calculate the maximum donation for a subset of the donations.
4) Calculate the number of donations exceeding a target value.
5) Calculate the number of donations of a particular dollar amount.
6) Calculate what percentage of the donations (value wise) are under a target value.
7) Quit
6
What is the target donation?
500
Donations under $500 accounted for 17.50 percent of the total funds raised.