Output the file content with line number to another text file So if an input file...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
• Output the file content with line number to another text file So if an input file named "fred.txt" contains: Hello, I am Fred. I am enrolled in ICT167. Bye • And the user enters "fred.txt" and "fred Num.txt", Then after running the program "fredNum.txt" will contain something like: 1 Hello, 2 3 I am Fred. 4 I am enrolled in ICT167. 15 6 Bye • Q2 has a sample on how to write to file Q2 • Declare Score array as a class static variable • Create Score array of size 10 Implement the methods. ● readScoreFromFile() • Read in line by line, each line is a store record • Convert the record to a Score object and store in Score array computeHighest LowestAverageScore() • . Declare highestScore, lowestScore and averageScore as class static variable In the method compute the three values. • Submit next week writeResultToFile() • Write the results to output.csv Q2 • Submit next week computeHighest LowestAverageScore() • In the method compute the three value. • highestScore, lowestScore and averageScore • Output the file content with line number to another text file So if an input file named "fred.txt" contains: Hello, I am Fred. I am enrolled in ICT167. Bye • And the user enters "fred.txt" and "fred Num.txt", Then after running the program "fredNum.txt" will contain something like: 1 Hello, 2 3 I am Fred. 4 I am enrolled in ICT167. 15 6 Bye • Q2 has a sample on how to write to file Q2 • Declare Score array as a class static variable • Create Score array of size 10 Implement the methods. ● readScoreFromFile() • Read in line by line, each line is a store record • Convert the record to a Score object and store in Score array computeHighest LowestAverageScore() • . Declare highestScore, lowestScore and averageScore as class static variable In the method compute the three values. • Submit next week writeResultToFile() • Write the results to output.csv Q2 • Submit next week computeHighest LowestAverageScore() • In the method compute the three value. • highestScore, lowestScore and averageScore
Expert Answer:
Answer rating: 100% (QA)
Code to output file content with line numbers Python Python def numberlinesinputfile outputfile Read... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
THIRD AVENUE SOFTWARE HEALTH-CARE APP PROJECT This case is new for the ninth edition of Information Technology Project Management . The case provides an opportunity to apply agile and Scrum...
-
Skip to main content Lab 11: A Web Server The goal of this lab is to write a simple, but functional, web server that is capable of sending files to a web browser on request. The web server must...
-
The owner of Atlantic City Confectionary is considering the purchase of a new semiautomatic candy machine. The machine will cost $25,000 and last 10 years. The machine is expected to have no salvage...
-
In Zimbabwe the rate of inflation hit 90 sextillion percent in 2009, with prices increasing tenfold every day. At that rate, how much would a $100 textbook cost one week later?
-
Insert the correct sign of inequality (> or
-
Consider two alternatives, each of which will accomplish the same EPA-mandated pollution control. Using an incremental IRR analysis, determine the preferred alternative assuming MARR is 20...
-
McKnight Handcraft is a manufacturer of picture frames for large retailers. Every picture frame passes through two departments: the assembly department and the finishing department. This problem...
-
3. A 200 kg roller coaster starts from rest at the top of the first hill at a height of 20 m above the ground. The second hill is 15 m above the ground. a. A physics student in line for the ride...
-
What is the role of accounting in business?
-
Since the allowable depreciable life on an apartment building is 27.5 years, versus 39 years for a shopping center, an apartment complex must have substantially lower annual capital expenditure...
-
The United States has long been called a melting pot. What does this term mean? Do you agree that the U.S is a melting pot ? Define a subculture and give examples of U.S subcultures Identify the...
-
Briefly introduce your industry, its NAICS code and the companies (main competitors) you've analyzed within it
-
You are stranded on a serene tropical island with a campfire, a scuba tank and a reference tome on the composition of tropical plants. Your tome suggests that the available palm wood consists of 20...
-
Write a Python program that simulates N= 100000 rolls of two six-faced dice, counts the number of times Nos of getting at least one 6 from the dice rolls, and finally output the estimated probability...
-
8 A uniform metre rule of weight 2.0 N is pivoted at the 60 cm mark as shown in Fig. 8. A 4.0 N weight is suspended from one end, causing the rule to rotate about the pivot. uniform metre rule A 0Nm ...
-
Determine the volume of the solid obtained by rotating the region bounded by y = x? - 2x and y = x about the line y = 4.
-
Comptech Ltd is a manufacturer of optical equipment. In September 2019, Ed Thompson the Chief Research Officer, attended a conference in Switzerland that focused on optical developments for the 21st...
-
In 2012, Margaret and John Murphy are married taxpayers who file a joint tax return with AGl of $25,000. During the year they incurred the following expenses: Hospitalization insurance...
-
During the 2012 tax year, Irma incurred the following expenses: Union dues..............................................................$275 Tax return preparation...
-
Clarita is a single taxpayer with two dependent children, ages 10 and 12. Clarita pays $3,000 in qualified child care expenses during the year. If her adjusted gross income (all from wages) for the...
-
Cathy, Heathcliff, and Isabelle are equal shareholders in Wuthering Heights (WH), an S corporation. Heathcliff has decided he would like to terminate the S election. In the following alternative...
-
Chandra was the sole shareholder of Pet Emporium, which was originally formed as an S corporation. When Pet Emporium terminated its S election on August 31, 2018, Chandra had a stock basis and an...
-
Winkin, Blinkin, and Nod are equal shareholders in SleepEZ, an S corporation. In the conditions listed below, how much income should each report from SleepEZ for 2019 under both the daily allocation...
Study smarter with the SolutionInn App