Questions
INPUT FILE INTO ARRAY. CHECKING FOR COMMAS AND SUCH. ***DO NOT REPLY ANUNAGA.*** HOW TO DO?...

INPUT FILE INTO ARRAY. CHECKING FOR COMMAS AND SUCH. ***DO NOT REPLY ANUNAGA.***

HOW TO DO?

*****IMPORTANT******* PLEASE READ CAREFULLY. WE HAVE TO DO WHAT THIS ASSIGNMENT DOES OR WE WILL MARKED OFF POINTS. IT DOES NOT HELP WHEN YOU CHANGE THE SKELETON TO YOU'RE PREFERENCE. YOU CAN ADD TO IT, BUT NOT CHANGE WHAT IS ALREADY THERE. THIS IS FOR A BASIC C++ LEVEL CLASS SO WE HAVE TO STICK TO BASIC C++ CODE. HOWEVER IT COULD BE WRONG IN TERMS OF WORKING CONDITIONS SO PLEASE HELP FIX THESE. *IMPORTANT*

Input format for each line: F=firstname,L=lastname,V=votes.
Read only valid lines into the array

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? IT IS A SKELETON, WHICH MEANS MORE VARIABLES AND SUCH CAN BE ADDED:

#include

#include

#include

#include

#include

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

Hello, I have created the following code in C++. The goal of this code is to...

Hello,

I have created the following code in C++. The goal of this code is to read 3 types of employee information(String/*Name*/, String/*Phone number*/,Int/*Office number*/, ) from a .txt file and store that information into an array which can be accessed by various functions. The code below is within a header file, and im trying to define some functions (within a .cpp file) of my class to carry out the following tasks.

I have already managed to define a couple functions, but I'm stuck on the two listed below and need help coding them.

Thank you.

CODE:
#include <iostream>
#include <string>
#include <fstream>

using namespace std;

const int SIZE = 25;

struct Phone
{
   string employeeName;
   string phoneExt;
   int officeNumber;
};

class Directory
{
public:
   Directory(string/*file name*/, int = SIZE/*max number of employees*/);
   void showPhone(string/*employee phone*/, int /*employee office*/);
   void showPhoneOffice(string/*Name*/) const;
   void writeDirectory(ostream &)const;
   void addEmployee(string/*Name*/, string/*Phone*/, int/*Office*/); // this is second function I need help defining
   void showNoEmployees(ostream &) const; //This is first function I need help defining
   int getNoEmployees() const {return noEmployees;}


private:
   Phone employees[SIZE];
   int maxEmployees;
   int noEmployees;
   void findEmployee();
  
};

1. showPhoneOffice() that displays a string(a name) and int( a phone number). The function receives the string and int. It does not return a value. Displays the data or a meaningful error message if the string was not found

2. . addEmployee() that adds an employee(string/*Name*/,string/*Name*/,int/*Office Number*/) to the employee array. The function receives the employee’s string, string and int. It does not return a value. Ensure the employee is not already in an existing array and that the array is not full. You can assume valid data is passed.

In: Computer Science

1) In each scenario below, specify each variable as a response variable, an explanatory variable, or...

1) In each scenario below, specify each variable as a response variable, an explanatory variable, or neither.

a. A researcher collects measurements of VO2 max and resting heart rate on a group of
subjects to study the relationship between these two variables.

b. A real estate agent wants to be able to predict selling prices of houses in Vancouver. He
collects data on 100 recently sold houses, recording their selling prices, size, age, number
of bedrooms, and whether they had a suite.

c. A physicist is investigating particle decay rates. She conducts a series of experiments,
recording in each the number of remaining particles at each time point.

2) I don’t like eating over-ripe bananas, and am interested in understanding the
factors that influence the ripening time of bananas after I bring them home from the store
(which I define as the time until a brown spot appears). I decide to conduct an experiment.
Every Sunday for 8 weeks, I buy a bunch of 6 green/yellow bananas, and record the time
until the first brown spot appears on each banana (so that I end up with 48 measurements on
ripening time). Each week, I try a different combination of methods of storing the bananas
(“treatment”): in a dark cupboard or in the light, with or without an ethylene absorber, and
close to or far away from other produce (fruits and vegetables). The details of my storage
plans are as follows in the below table:

(Week) (Dark/Light) (Ethylene Absorber?) (Close to Other Produce?)
1 Dark Yes Yes
2 Dark Yes No
3 Dark No Yes
4 Dark No No
5 Light Yes Yes
6 Light Yes No
7 Light No Yes
8 Light No No

a. What are the factors in this experiment, and what are the corresponding levels?

b. What are the individuals in this experiment?

c. Is this a randomized controlled experiment? Explain.

d. I find that the bananas that I stored in the dark with an ethylene absorber away from other
produce had a longer ripening time than the bananas in other bunches. Would you suspect
that this storage method causes longer ripening time, or that a confounding factor was at
play? Explain and, if the latter, provide a plausible example of such a factor.

e. Suggest an improvement to my experimental design (other than increasing my sample
size).

In: Statistics and Probability

1. A poultry company undertook an experiment to determine the effect of certain treatments on chicken...

1. A poultry company undertook an experiment to determine the effect of certain treatments on chicken growth. A sample of 24 young chicks were given one of three possible treatments to aid their growth. In order of cost from least to most costly, the three treatments were as follows: a cheap food; an expensive food; the expensive food plus an injection of a growth serum. After a fixed period of time, the application of the treatments was halted and the chickens were weighed. The response was their increase in weight (in pounds) over the time period of the experiment. Because of space considerations, the experiment had to be carried out in four different laboratories. These laboratories were randomly selected and labeled as “North”, “South”, “East” and “West”. Each laboratory employed a different technician to carry out the experiment. Six chickens were assigned to each laboratory, and the three treatments were randomly assigned to the chickens within each laboratory (two chickens having each treatment within each laboratory). In your mini-report, explain why it makes sense to design and analyze this as a block design. Using the sample data, formally test whether it turned out to be sensible to use blocks, providing numerical justification (test statistic and P-value) for your conclusion. Also formally assess the main research question of interest: whether the three treatments yield significantly
different mean growth, again providing numerical justification (test statistic and P-value) for your conclusion. If you find a difference across the treatments, investigate exactly which treatments differ significantly from each other. Provide recommendations to the poultry company about their best practices based on your findings.

SAS code:

/* Problem 1 */


DATA one;
INPUT lab $ treatment :$12. growth;
cards;
East Cheap 4.62
East Cheap 4.93
East Expens 6.25
East Expens 5.97
East Expens_Serum 6.41
East Expens_Serum 6.54
West Cheap 5.36
West Cheap 5.49
West Expens 6.53
West Expens 6.62
West Expens_Serum 6.81
West Expens_Serum 6.63
North Cheap 4.65
North Cheap 5.32
North Expens 5.96
North Expens 6.12
North Expens_Serum 6.33
North Expens_Serum 6.44
South Cheap 5.76
South Cheap 6.32
South Expens 6.47
South Expens 6.68
South Expens_Serum 6.71
South Expens_Serum 6.78
;
run;

In: Statistics and Probability

Question 9 One of the key early tests of Einstein's General Theory of Relativity was the...

Question 9

One of the key early tests of Einstein's General Theory of Relativity was

the bending of the path of starlight and resulting apparent shift in the position of stars because of the Sun's mass.

sending a twin in a spaceship to the nearest star and back at a high Lorentz factor.

the Michelson-Morley experiment.

measuring the time dilation effect from gas falling into a black hole.

Question 10

According to General Relativity,

Group of answer choices

you can think of space as "flowing in" towards massive objects.

space-time has curvature.

time runs fastest far away from massive objects.

the path of light is bent when photons move through curved space.

All of these choices are correct.

None of these choices is correct.

Question 11

You are in a rocket ship deep in space and are about to pass a fellow traveler going the opposite direction at 99.9% the speed of light. You think her clock is _________ than yours and she thinks that your clock is __________ than hers.

faster; faster

faster; slower

slower; slower

slower; faster

Question 12

By observing a _____________ in 1919, astronomers were able to test the prediction that a massive object bends the path taken by light.

Group of answer choices

transit of the planet Mercury across the Sun

transit of the planet Venus across the Sun

supernova

total solar eclipse

total lunar eclipse

Question 13

The twin paradox is

a hypothetical experiment that demonstrates that special relativity is wrong

a hypothetical situation that seemingly presents a paradox but is actually resolved by a clearer understanding of the situation

a real experiment that demonstrates that special relativity is wrong

a real experiment that is consistent with the predictions made by special relativity

Question 14

Within special relativity, time dilation refers to ...

the slowing of the passage of time due to motion near the speed of light.

the speeding up of the passage of time due to motion near the speed of light.

the gradual slowing of the rotation of pulsars.

the Doppler shift of light.

Question 15

The alteration of our perception of space and time due to motion near the speed of light is described by

Group of answer choices

special relativity

general relativity

Newton's laws of motion

Galileo's law of inertia

Question 16

The curving of space by a massive object is described by which theory?

Group of answer choices

special relativity

general relativity

Newton's laws of motion

Galileo's law of inertia

In: Physics

1. If you want to invest in a particular stock, name key information you would seek...

1. If you want to invest in a particular stock, name key information you would seek out prior to making your investment.

2. Name some ways that top management might manipulate the financial statements of the business, to ensure that the year-end profitability looks good, thus attracts a big bonus for themselves.

In: Finance

1. What are the contents of culturing media? What are the types of culturing media? 2....

1. What are the contents of culturing media? What are the types of culturing media?

2. Define the following terms: inoculum/sample, broth, culture, colonies, fastidious bacteria, agar, slants.

3. Name of selective, differential , selective and differential media along with the name of bacteria.

4. What happen to alpha, beta and gamma hemolysis?

In: Biology

What is the diagnostic procedure for glucose tolerance? ACTIVE LEARNING TEMPLATE:Diagnostic Procedure STUDENT NAME _____________________________________ PROCEDURE...

What is the diagnostic procedure for glucose tolerance?

ACTIVE LEARNING TEMPLATE:Diagnostic Procedure

STUDENT NAME _____________________________________

PROCEDURE NAME ____________________________________________________________________ REVIEW MODULE CHAPTER ___________

Description of Procedure

Indications

Interpretation of Findings.

CONSIDERATIONS

Nursing Interventions (pre, intra, post)

Potential Complications.

Client Education

Nursing Interventions.

ACTIVE LEARNING TEMPLATES                                                                                                                                                                 TherapeuTic procedure A3

In: Nursing

When posting about your CAFR or NFP entity, include the entity name in the Subject line...

When posting about your CAFR or NFP entity, include the entity name in the Subject line and the web link to the document in your posting.

1. What is the name and city of the auditors for the CAFR?

2. Does the auditors' opinion reveal any unfavorable issues?

3. MD&A section: discuss any highlights or issues of concern

In: Accounting

1) Name the three National Credit Bureaus 2) What is the purpose of the Consumer Financial...

1) Name the three National Credit Bureaus

2) What is the purpose of the Consumer Financial Protection Bureau?

3) If a credit card is lost or stolen what is the maximum liability for the cardholder?

4) Name three things to look for in finding a reliable credit counselor.

5) How will filing for bankruptcy impact your credit score?

In: Finance