Question
Please and Thank You Hi Im having trouble building the code for this assignment. need help C++ visual studio THE CODE NEEDS TO BE EXTREMELY
Please and Thank You
Hi Im having trouble building the code for this assignment. need help
C++ visual studio
THE CODE NEEDS TO BE EXTREMELY SIMPLE.
THE CODE NEEDS TO BE EXTREMELY SIMPLE.
THE CODE NEEDS TO BE EXTREMELY SIMPLE.
THE CODE NEEDS TO BE EXTREMELY SIMPLE.
Simple things like
Classes
Objects
Arrays
Varabiles / properties / fields / methods of a class
Iostream
String
Frstream
Not much of anything more
Here is the assignment --- the picture of how it turns out is attached.
The election season is upon us. The amount of money a candidate raises against his/her opponent greatly affects the outcome of the election. Anders and Valerie (completely fictional characters) are two fierce opponents fighting for the democratic party nomination.
Your job is to write a program that will help us keep track of the donations to these candidates. You will assume that the program is written for this election where Anders and Valerie are running. It is OK to hard code these into your program. Dont worry about case sensitivity of names.
Here are the features of the program:
Feature #1: Contribute to a Campaign [60 points]
When someone wants to make a contribution we use this feature to enter the contribution information to the system. Program asks for which candidate the contribution is, and the amount of the contribution, along with the name of the person making the contribution.
To make things easier for you -- You may assume that the name of the donor is just the last name. No spaces allowed in the last name and assume that no two donors will ever have the same last name. :-)
According to US laws, no individual is allowed to make political contributions exceeding $2700 per election. The program should not accept the contribution if the total amount of contribution of that individual (go by last name) exceeds $2700 [50 points].
The candidate that will be entered by the user will always be either Anders
or Valerie -- you do not need to error check for this.
The program supports up to 1000 donations.
Feature #2: Report per Candidate
a) Displays how many contributions are in the system for each candidate. [30 points]
b) The total amount contributed for each candidate. [30 points]
c) The average contribution amount for each candidate. This is basically the number you found for a) divided by the number you reported for b) for each candidate. [30 points]
File I/O [60 points]: Make sure that you have file I/O in place so we do not loose information when we close the program.
Classes [40 points]: Make sure that you are using a class representing a donation..
Avoid Penalties:
- Each feature must be in a separate function (-60). You must use arrays to hold the data (-60)
- Your program does not compile and/or crashes while running (-60).
- Your program is not properly indented and/or commented (-60).
- Global variables are not allowed (-60).
Assume that I will deduct the maximum amount if you hit these penalties. I will also deduct the maximum amount if any of the features of the program is not functioning properly
---------------------------------------
here is some of it but it is missing FILE I/O and Classes
-----------------------------------------------------------------------------------------
File I/O: Ability to read data from file and ability to write data to a file.
Step 1: include fstream library
Step 2: make sure the file is located inside the same folder as the project file of the program. Once compiled, the file should be in the same folder as the executable file (*.exe).
Step 3: make sure extensions are not hidden!.
- On your computer, open up My computer,
- hit Alt button to make the menu visible
- on the menu, Tools > Folder Options,
- go to View tab
- make sure "Hide extensions for known file types" is UNCHECKED.
- Hit OK to close.
Step 4: open up the file for reading or writing. ifstream to open for reading. ofstream to open for writing.
Step 5: keep reading the file like reading from keyboard.
file.eof() gets you if you are at the end of the file.
Step 6: file.close(); to close the file when we are done.
---------------------------------------------------------
Example of class - not for this, this is a sample for loans, not contributions
class Loan { public: int Age; int Score; int Amount;
double GetRiskFactor() { double ageFactor = 1;
if (Age
int riskFactor = (Amount / Score) * ageFactor; return riskFactor; } };
--------------------------------------------
here is the code but as i said it is
im trying to put in file I/o and classes please help!
#include
using namespace std;
int main() { int option; // user's entered option will be saved in this variable int amt=0, amt1=0, tot=0, tot1=0, i=0, j=0, g=0, h=0; string name, name1; do //do-while loop starts here.that display menu again and again until user select to exit program { //Displaying Options for the menu cout > option; // taking option value as input and saving in variable "option" if(option == 1) // Checking if user selected option 1 { cout>name; if(name=="Anders"){ cout>amt; cout>name1; tot = tot+amt; i++; if(tot>2700){ tot = tot-amt; cout>amt1; cout>name1; tot1 = tot1+amt1; j++; if(tot1>2700){ tot1 = tot1-amt1; cout0) g = tot/i; cout0) h = tot1/j; cout
-----------------------------------------------------
.
Election Contributions v1.0 Anders vs. Valerie 1- Contribute to a Campaign 2- Report per Candidate 0- Exit Make a choice (1-3): 1 Candidate (Anders or Valerie): Anders Donation Amount: 1300 Your Name: Jackson Election Contributions v1.0 Anders vs. Valerie 1- Contribute to a Campaign 2- Report per Candidate 0- Exit Make a choice (1-3): 1 Candidate (Anders or Valerie Anders Donation Amount 1500 Your Name: Jackson You cannot exceed $2700 per election Election Contributions v1.0 Anders vs. Valerie 1- Contribute to a Campaign 2- Report per Candidate 0- Exit Make a choice (1-3): 2 Anders: Total: $1300 of Donations: 1 Aug. Amount: $1300 Valerie: Total $0 H of Donations: 0 Aug. Amount $0 Election Contributions v1.0 Anders vs. Valerie 1- Contribute to a Campaign 2- Report per Candidate 0- Exit Make a choice (1-3): 1 Candidate (Anders or Valerie Valerie Donation Amount 500 Your Name: Brown Election Contributions v1.0 Anders vs. Valerie 1- Contribute to a Campaign 2- Report per Candidate 0- Exit Make a choice (1-3): 2 Anders: Total: $1300 of Donations: 1 Avg Amount: $1300 Valerie: Total $1500 H of Donations: 1Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started