Questions
INPUT FILE INTO ARRAY. CHECKING FOR COMMAS AND SUCH. HOW TO DO? ****IMPORTANT**** PLEASE READ CAREFULLY...

INPUT FILE INTO ARRAY. CHECKING FOR COMMAS AND SUCH. HOW TO DO? ****IMPORTANT**** PLEASE READ CAREFULLY ****IMPORTANT****

***GOALS***

HOW TO CHECK FOR COMMAS, TILL THE END OF FILE. IT WILL CHECK THE LINE FOR THE APPRORIATE FORMAT IN THE TEXT FILE. IF THERE IS MISSING A COMMA, IT WILL IGNORE, IF THERE IS A WHITE SPACE, IT WILL CORRECT AND READ LINE, IF IT IS MISSING 1 OF THE 3 INFORMATION, IT WILL IGNORE.

Display candidates’ names using displayList() function
 Execute the getWinner(Candidate[]) function to get the candidate with the highest number of votes. Display his name along with number of votes.
 Execute the getLast(Candidate[]) function to get the candidate with the lowest number of votes. Display his name along with number of votes.
 Calculate pScore for each candidate
 Sort candidates by votes
 Display sorted list using displayList() function
 For three records with the highest pScore, use the roundScore function to round the pScore
 Display list again using displayList() function

void readFile(Candidate candidates[]) – reads the elections.txt file, fills the candidates[] array. Hint: use substr() and find() functions. Set Score to 0.


void List(Candidate candidates[]) – prints the array of Candidate structs. One candidate per one line, include all fields. Use setw() to display nice looking list.


void displayCandidate(Candidate candidates[]) – prints the complete information about the candidate

.
Candidate First(Candidate candidates[]) – returns single struct element: candidate with highest score


Candidate Last(Candidate candidates[]) – returns single struct element: candidate with lowest score


void Votes(Candidate candidates[]) – function sorts the candidates[] array by number of votes, the order in candidates[] array is replaced


void Scores(Candidate candidates[]) – calculates the percentage score for each candidate. Use the following formula: ??????=(CandidateVotes)/(sum of votes)*100%

Correct line for the reference: F=John,L=Smith,V=3342

The line errors that your program needs to detect, are as follows:

incorrect token / separator, example in line 5: F=Steven,L=JohnV=4429 --- (comma missing) – lines with this error need to be ignored

space in token, example in line 3: F=Hillary,X=Clinton, V=1622 --- lines with this error need to be read, error fixed, data included in your dataset

empty line, example in line 6 – empty lines need to be ignored

Example Textfile

F=Michael,L=John,V=3342

F=Danny,L=Red,V=2003

F=Hillary,L=Clinton, V=1588

F=Albert,L=Lee,V=5332

F=Steven,L=JohnV=4429

*IMPORTANT* How would I do the readFile function? It says to check if the commas are present, and that the program will correct the line if there is white spaces. How do i use the find() function? Please be DETAILED in explanations of each part of code. Beginner Coder. *IMPORTANT*

Code Skeleton We HAVE to follow. How Would i go about using this skeleton?YOU CANNOT CHANGE WHAT IS ALREADY THERE ON THE SKELETON, YOU MAY ADD EXTRA INFORMATION THOUGH:

#include <iostream>

#include <iomanip>

#include <string>

#include <stdlib.H>

#include <fstream>

using namespace std;

struct Candidate {
string Fname;
string Lname;
int votes;
double Score;
};

const int MAX_SIZE = 100;

void readFile(Candidate[]);

void List(Candidate[]);

void Votes(Candidate[]);

void displayCandidate(Candidate);

Candidate First(Candidate[]);

Candidate Last(Candidate[]);

void Scores(Candidate[]);

int main() {

}

void readFile(Candidate candidates[]) {

string line;

ifstream infile;

infile.open("elections.txt");

while (!infile.eof()) {

getline(infile,line);

// your code here

}

infile.close();

}

void List(Candidate candidates[]) {

}

void Votes(Candidate candidates[]) {

}

void displayCandidate(Candidate candidates) {

}

Candidate First(Candidate candidates[]) {

}

Candidate Last(Candidate candidates[]) {

}

void Scores(Candidate candidates[]) {

}

In: Computer Science

Develop a Entity-Relationship Diagram (ERD) Many-to-Many The city of Terra Haute, IN wants to maintain information...

Develop a Entity-Relationship Diagram (ERD)

Many-to-Many

The city of Terra Haute, IN wants to maintain information about its extensive system of high schools, including its teachers and their university degrees, its students, administrators, and the subjects that it teaches.

Each school has a unique name, plus an address, telephone number, year built, and size in square feet. Students have a student number, name, home address, home telephone number, current grade, and age. Regarding a student’s school assignment, the school system is only interested in keeping track of which school a student currently attends. Each school has several administrators, such as the principal and assistant principals. Administrators are identified by an employee number and also have a name, telephone number, and office number.

Teachers are also identified by an employee number and each has a name, age, subject specialty such as English (assume only one per teacher), and the year that they entered the school system. Teachers tend to periodically move from school to school and the school system wants to keep track of the history of which schools the teacher has taught in, including the current school. Included will be the year in which the teacher entered the school and the highest pay rate that the teacher attained at the school. The school system wants to keep track of the universities that each teacher attended, including the degrees earned and the years in which they were earned. The school system wants to record each university’s name, address, year founded, and Internet URL (address.) Some teachers, as department heads, supervise other teachers. The school system wants to keep track of these supervisory relationships but only for teachers’ current supervisors.

The school system also wants to keep track of the subjects that it offers (e.g. French I, Algebra III, etc). Each subject has a unique subject number, a subject name, the grade level in which it is normally taught, and the year in which it was introduced in the school system. The school system wants to keep track of which teacher taught which student which subject, including the year this happened and the grade received.

In: Computer Science

Presidential administrations often like to "tinker" with the tax code. Assume the tax code under former...

Presidential administrations often like to "tinker" with the tax code. Assume the tax code under former President O'Bomba listed the highest marginal tax rate at 40% and that President Chump reduced the marginal rate 30%, Which scenario below describes the most likely impact this change in tax policy will have on municipal and corporate bonds.

A. The after-tax yield on corporate bonds for investors in the highest tax bracket will be lower due to the reduction in the top tax rate.

B. Both muni and corporate bond yields will remain unchanged as a result of the new tax policy. Investors in the top tax bracket will always favor muni-bonds over corporate regardless of changes in the highest marginal tax rate.

C. Both muni and corporate bond yields will remain unchanged. Investors in the top tax bracket will buy more munis to save even more taxes.

D. The tax cut causes an increase in the after-tax yield on corporate bonds. In response, muni bond yields would rise (prices fall) to make them equally attractive as the after-tax yields on corporate bonds for investors in the top tax bracket.

In: Finance

4. A 2017 study showing that the proportion of peoplewith health insurance is higher among...

4. A 2017 study showing that the proportion of people with health insurance is higher among people with higher income

a. is an example of positive economics.

b. is an example of normative economics.

c. is an example of qualitative economics.

d. is an example of Australian economics.

5. A study arguing that the United States should adopt a single-payer health system

a. is an example of positive economics.

b. is an example of normative economics.

c. is an example of qualitative economics.

d. is an example of Australian economics.

6. Compared to Canada, France, Germany, Switzerland, and the United Kingdom, the United States

a. had the highest spending per person and the shortest life expectancy in 2016.

b. had the lowest spending per person and the shortest life expectancy in 2016.

c. had the lowest spending per person and the longest life expectancy in 2016.

d. had the highest spending per person and the longest life expectancy in 2016.

7. Rational decision making involves

a. choosing the cheapest option.

b. choosing the highest-quality option.

c. choosing the option that best helps you realize your goals, given your resources.

d.avoiding choices that involve scarce resources.

In: Economics

C++ Chapter 4/5 Lab Assignment Using concepts from chapters 1 – 5 only. Grading will be...

C++ Chapter 4/5 Lab Assignment Using concepts from chapters 1 – 5 only. Grading will be based on chapter 4 concepts more. Design a menu driven program that can keep track of five player’s scores. Your program must have the following documentation: A. Your name B. The program name C. Program Description D. The date the exe file was created E. The code: a. Use a menu approach do the following: i. to Add a player information ii. to Search for any player based on their name. iii. to Display all the information at any time (Hint : Use value and reference parameters as necessary).. b. Organize the main program to call input and output functions. Use static variables to keep track of player’s information. c. Input the names of five players and their highest scores on three games they ever played. Do Not Hard-Code the players’ names and their scores. d. Create an average function to compute the average highest score of each player i.e. ( john: g1 100 g2 200 g3 300. Average highest score will be 200.00).

In: Computer Science

A)Consider the following gases, all at STP: Ne, SF6, N2, CH4. Which gas is most likely...

A)Consider the following gases, all at STP: Ne, SF6, N2, CH4.

Which gas is most likely to depart from assumption 3 of the kinetic molecular theory (Attractive and repulsive forces between gas molecules are negligible.)?

Which one is closest to an ideal gas in its behavior?

Which one has the highest root-mean-square molecular speed?

Which one has the highest total molecular volume relative to the space occupied by the gas?

Which has the highest average kinetic molecular energy?

Which one would effuse more rapidly than N2?

B) A mixture of gases contains 0.75mol N2, 0.35mol O2, and 0.20mol CO2. The total pressure of the mixture is 1.57atm .

What is the partial pressure of O2?

What is the partial pressure of CO2?

C) What is the partial pressure in atm of O2 of this mixture if it is held in a 12.60?L vessel at 14?C? (O2 =.149mole)

What is the partial pressure in atm of N2 of this mixture if it is held in a 12.60?L vessel at 14?C? (N2= .241mole)

What is the partial pressure in atm of H2 of this mixture if it is held in a 12.60?L vessel at 14?C?(H2= .610mole)

In: Chemistry

Suppose the average number of returns processed by employees of a tax preparation service during tax...

Suppose the average number of returns processed by employees of a tax preparation service during tax season is 10 per day with a standard deviation of 6 per day. A random sample of 36 employees taken during tax season revealed the number of returns processed daily shown below. Use these data to answer parts a through c.

14

14

13

13

9

13

13

11

16

13

17

13

14

11

13

13

14

14

10

10

7

17

13

10

10

17

7

8

11

10

6

4

13

9

9

5

a. What is the probability of having a sample mean equal to or smaller than the sample mean for this sample if the population mean is 10 processed returns daily with a standard deviation of 6 returns per​ day?The probability is (Round to four decimal places as​ needed.)

b. What is the probability of having a sample mean larger than the sample mean for this sample if the population mean is 10 processed returns daily with a standard deviation of 6 returns per​ day?The probability is ​(Round to four decimal places as​ needed.)

c. Explain how it is possible to answer parts a and b when the population distribution of daily tax returns at the tax firm is not known. Choose the correct answer below.

A. The Central Limit Theorem can be applied because the sample size is sufficiently large.​ Thus, the distribution of the sample means will be approximately normal.

B. The Central Limit Theorem can be applied because the sample size is not large.​ Thus, the distribution of the sample means will be approximately normal.

C. The Central Limit Theorem can be applied because the sample size is sufficiently large.​ Thus, the distribution of the sample means will be either skewed to the left or skewed to the right.

D. All data are normally distributed.​ Thus, the distribution of the sample means will be approximately normal.

In: Statistics and Probability

Before lending someone​ money, banks must decide whether they believe the applicant will repay the loan....

Before lending someone​ money, banks must decide whether they believe the applicant will repay the loan. One strategy used is a point system. Loan officers assess information about the​ applicant, totaling points they award for the​ person's income​ level, credit​ history, current debt​ burden, and so on. The higher the point​ total, the more convinced the bank is that​ it's safe to make the loan. Any applicant with a lower point total than a certain cutoff score is denied a loan. Think of this decision as a hypothesis test. Since the bank makes its profit from the interest collected on repaid​ loans, their null hypothesis is that the applicant will repay the loan and therefore should get the money. Only if the​ person's score falls below the minimum cutoff will the bank reject the null and deny the loan. Complete parts a through c below.

a) In this context, what is meant by the power of the test?

A. The power is the probability that the bank approves a loan that will be repaid.

B. The power is the probability that the bank denies a loan that would have been repaid.

C. The power is the probability that the bank approves a loan that will not be repaid.

D. The power is the probability that the bank denies a loan that would not have been repaid.

b) What could the bank do to increase the power?

A. The bank could hire additional loan officers to assess each​ applicant's information.

B. The bank could lower the cutoff score.

C. The bank could raise the cutoff score.

D. The bank could scrap the point system.

c) What is the disadvantage of taking the action in part b)?

A. A larger number of untrustworthy people would have their loans​ approved, and the bank would lose money from those unpaid loans.

B. The bank would have to spend more money on the additional loan officers.

C. The bank would have to spend additional time and money developing a new system.

D. A larger number of trustworthy people would be denied​ credit, and the bank would miss the opportunity to collect interest on those loans.

In: Statistics and Probability

Consider the following version of the Lucas model. The number of young individuals born on island...

Consider the following version of the Lucas model. The number of young individuals born on island i in period t, ?????? , is random according to the following specification:

???= (1/4)N with probability 0.5,

???= (3/4)N with probability 0.5,

where N denotes the total number (i.e. across the two islands) of young people born in every period. Assume that the fiat money stock ???? grows at the fixed rate ?? in all periods.

a. Set up the budget constraints of an individual when young and when old in terms of ?????? (where ?????? denotes an individual’s labour supply). Find the lifetime budget constraint of an individual.

b. Set up the money market-clearing condition.

c. On which island would you prefer to be born? Explain with reference to the rate of return to labour.

d. Show how the rate of return to labour and the individual's labour supply depend on the value of ??.

For the remaining questions, assume now that the growth rate of the fiat money stock ???? is random according to:

??=?? with probability θ, where 0 ≤ θ ≤ 1;

??=?? with probability 1-θ.

The realization of ???? is kept secret from the young until all purchases of goods have occurred (i.e. individuals do not learn ???? until period t is over). Given these changes in assumption, answer the following questions:

e. How many states of the world would agents be able to observe if information about every variable were perfectly available? Describe those possible states.

f. How many states of the world are the agents able to distinguish when there is limited information (i.e. they do not know the value of ????)?

g. Draw a graph of labour supply and the growth rate of the fiat money stock in each possible state of the world when there is limited information. What is the correlation observed between money creation and output?

h. Suppose the government wanted to take advantage of the relation between money creation and output. If it always inflates, will the graph you derived in part f remain the same? Explain fully.

In: Economics

Dee F. is considering building a drive-up/drive thru coffee stall at a location she researched as...

Dee F. is considering building a drive-up/drive thru coffee stall at a location she researched as a viable location. The location can accommodate a maximum of 10 cars. Based on her research, customer arrivals follow a Poisson probability distribution, with a mean arrival rate of 25 cars per hour, and that service times follow an exponential probability distribution. Arriving customers will place their orders at an intercom station as soon as they enter the lot where the stall will be located, and then drive to the service window to pay for and receive their orders. Three service alternatives are being considered:

  • A single channel operation in which one employee, whose hourly wage rate is $15, fills the order and takes the money from the customer. The average service time for this alternative is 2 minutes.
  • A single-channel operation in which one employee fills the order while a second employee takes the money from the customer. Each employee has an hourly wage of $15. The average service time for this alternative is 1.50 minutes
  • A two-channel operation with two service windows and two employees in each service window. Each of the employees has an hourly wage of $15. The employees stationed at each window fills the order and takes the money for customers arriving at the window. The average service time for this alternative is 1.5 minutes for each channel.
  1. Complete the table below comparing the three alternatives on the following service characteristics. Show your outputs used in completing the table.

Waiting Line Effectiveness Measures

Option 1: One window, one employee

Option 2: One window, two employees

Option 3: Two windows, two employees

Probability that there will be no car in the system.

Average number of cars waiting for service

Average time (in minutes) a car waits for service

Average time for a car to be in the system

Average number of cars in the system

The probability that an arriving car will have to wait for service

  1. Which of the three options will you recommend Dee F. to use? Support your answer.

In: Operations Management