Create a function named PrintStudents, which takes a string input filename and an integer minimum score...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Create a function named PrintStudents, which takes a string input filename and an integer minimum score value and a string output file name as a parameters. The function will read the student scores and names from the file and output the names of the students with scores greater than or equal to the value given. This function returns the integer number of entries read from the file. If the input file cannot be opened, return-1 and do not print anything to the file. Read each line from the given filename, parse the data, process the data, and write the required information to the file. Each line of the file contains <FIRST-NAME LAST-NAME>, <SCORE>, <SUBJECT>. Read and parse the data, then write to the output file the names and classes for scores matching the criteria. Example: With the following data and value of 80: Constance Shelton, 67, APPM 2002 Charlotte Edwards, 85, CSCI 1300 Alyssa Hill, 78, MATH 1000 Pat Owens, 75, HUMN 1342 Shannon Jimenez, 96, LING 2000 Kristen Swanson, 80, PSYC 1001 Jim Schwartz, 60, CVEN 3241 Your function should return 7 and output to the file should contain: Charlotte Edwards, CSCI 1300 Shannon Jimenez, LING 200 Kristen Swanson, PSYC 1001 You only need to write the function code. Our code will create and test your class. HINT: We have provided a function that may make the parsing easier: int split(string 5, char sep, string words[], int max_words); Create a function named PrintStudents, which takes a string input filename and an integer minimum score value and a string output file name as a parameters. The function will read the student scores and names from the file and output the names of the students with scores greater than or equal to the value given. This function returns the integer number of entries read from the file. If the input file cannot be opened, return-1 and do not print anything to the file. Read each line from the given filename, parse the data, process the data, and write the required information to the file. Each line of the file contains <FIRST-NAME LAST-NAME>, <SCORE>, <SUBJECT>. Read and parse the data, then write to the output file the names and classes for scores matching the criteria. Example: With the following data and value of 80: Constance Shelton, 67, APPM 2002 Charlotte Edwards, 85, CSCI 1300 Alyssa Hill, 78, MATH 1000 Pat Owens, 75, HUMN 1342 Shannon Jimenez, 96, LING 2000 Kristen Swanson, 80, PSYC 1001 Jim Schwartz, 60, CVEN 3241 Your function should return 7 and output to the file should contain: Charlotte Edwards, CSCI 1300 Shannon Jimenez, LING 200 Kristen Swanson, PSYC 1001 You only need to write the function code. Our code will create and test your class. HINT: We have provided a function that may make the parsing easier: int split(string 5, char sep, string words[], int max_words);
Expert Answer:
Answer rating: 100% (QA)
def PrintStudentsfilename val n 0 try myfile openfilename r for li... View the full answer
Related Book For
Posted Date:
Students also viewed these computer engineering questions
-
What information do companies disclose in addition to the financial statements?
-
In addition to the general guidelines for sales messages, what specific guidelines apply to sales-oriented email messages?
-
In addition to the random noise shrinkage, what other general factors affect dimensional accuracy in FF processes?
-
Using the displacement formulation given in Section 9.3.2, use standard separation of variables to solve the torsion problem of a rectangular section shown in Fig. 9.12. Verify your solution with...
-
Will and Sandra Emmet were divorced this year. As part of the property settlement, Sandra transferred marketable securities to Will. Her basis in the securities was $89,800, and their FMV was...
-
Golden State Warriors: One Game During a record breaking season the Golden State Warriors of the National Basketball Association (NBA) won 24 straight games to start the 2015-2016 season. Adam Pearce...
-
What is the proof of service?
-
Into what two categories does the FASAB divide government assets? How are each of the two accounted for?
-
The Twain Mill Company has issued rights to its shareholders.The stock is currently selling for $20 rights-on.The subscription price on the rights offering is $18.Three rights are required to...
-
Passion Company is trying to decide whether or not to acquire Desiree Inc. The following balance sheet for Desiree Inc. provides information about book values. Estimated market values are also...
-
The Elements Corporation reflects the following capital structure as of January 1: 10,000 Preferred Shares, 5%, issued and outstanding; $10 even value. 10,000 Common Shares, issued and outstanding;...
-
What are the two important objectives of the project cost-control system?
-
What critical elements are important to support the planning process?
-
What are impediments to planning, both at the beginning of a project and throughout the project?
-
Why is accurate and honest time reporting critical?
-
Why is the bar chart not an adequate planning and scheduling tool?
-
The following table shows the market information of various European put options on a non-dividend paying asset. Time to Strike price Market Price maturity Option A 9 months $42 3.59 Option B 3...
-
Archangel Corporation prepared the following variance report. Instructions Fill in the appropriate amounts or letters for the question marks in the report. ARCHANGEL CORPORATION Variance...
-
At December 31, Vicki's Designers had gross accounts receivable of $346,000. Historically, Vicki's Designers has estimated bad debt expense as 5% of gross receivables. Required a. Calculate bad debt...
-
A company issued 200 shares of $2 par value stock for $10 per share on January 14. Required Prepare the entry that the company would make to record the issuance. How would the entry change if the par...
-
Fly Corporation issued 10-year bonds on January 1, 2006. On July 1, 2012 Fly Corporation decides to retire the bonds early. The call price is $212,000 and the carrying value of the bonds on the date...
-
Show from combination of the equation for current and the flux expression that the conductivity of an electrolyte solution is given by \[\kappa=\frac{F^{2}}{R_{\mathrm{G}} T} \sum_{i}^{N} D_{i}...
-
Verify by inputting the various constants that \(R_{\mathrm{G}} T / F\) is equal to \(k_{\mathrm{B}} T / e\).
-
Consider an uncharged membrane of thickness \(100 \mu \mathrm{m}\) with concentrations of \(1 \mathrm{M} \mathrm{HCl}\) on one side and \(0.1 \mathrm{M} \mathrm{HCl}\) on the other side. Assume that...
Study smarter with the SolutionInn App