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...
-
A recent article in USA Today reported that Apple had 74% of the digital music device market, according to researcher The NPD Group. The NPD Group provides global sales and marketing information that...
-
The health fitness business has become increasingly popular as the sedentary lifestyle of most Americans has caused a large percentage of the population to feel, and be, out of shape. Health clubs...
-
Describe briefly the process from project needs assessment to project planning.
-
Robert Perez is a contractor specializing in custom-built jacuzzis. On May 1, 2012, his ledger contains the following data. Raw Materials Inventory ....... $30,000 Work in Process Inventory ..........
-
what is a tactical process map and how does it relate to a Value Stream Map?
-
Susan Jones would like her investment portfolio to be selected from a combination of three stocks Alpha, Beta, and Gamma. Let variables A, B, and G denote the percentages of the portfolio devoted to...
-
1. Dickens, a citizen and resident of the United Kingdom, occasionally purchases and sells securities on the New York and American Stock Exchanges. He effects his transactions through a stockbroker...
-
Kowalczyk Company spends $30000 dollars for manufacturing equipment. When should the cost of the equipment be expensed? Over the period that the equipment will be used When the performance obligation...
-
On September 3, 2023, Wilkins purchased 1244 stock in Brass Corporation for $6,000. On December 31, 2023, the stock was worth $8,500. On August 15, 2024, Wilkins was notified that a. 2023-$0;...
-
Discuss the main distinguishing features of majority, concurring, and dissenting opinions
-
July August September October November December Total Average 350 450 460 390 390 360 4,960 413 3,020 3,500 4,020 3,290 3,170 3,070 $ 43,571 $ 3,631 PR 6-38 (Algo) Part 4 Compute the variable cost...
-
Li Company has a unit selling price of $150, unit variable costs of $45, and total fixed costs of $47,200. How much sales revenue must Li Company generate to achieve net income of $27,700. Sales...
-
How is ECEF speed calculated? The expected baseline for calculating ECEF velocities is the discrete Position/Time between consecutive points. The velocity at the first input point is defined as 0....
-
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...
-
A university is deciding between two meal plans. One plan charges a fixed fee of \($600\) per semester and allows students to eat as much as they want. The other plan charges a fee based on the...
-
Evaluate this statement: You are a natural athlete, an attractive person who learns easily and communicates well. Clearly, you can do everything better than your friends and acquaintances. As a...
-
You have waited 30 minutes in a line for the Star Tours ride at Disneyland. You see a sign that says, From this point on, your wait is 45 minutes. You must decide whether to remain in the line or to...
Study smarter with the SolutionInn App