Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I'm having problems with writing this code. I have added my code below. There are six different files to choose from. strengths3.dat pulsars3.dat strengths3.dat pulsars2.dat

I'm having problems with writing this code. I have added my code below. There are six different files to choose from.

strengths3.dat

pulsars3.dat

strengths3.dat

pulsars2.dat

strengths1.dat

pulsars1.dat

image text in transcribed
TO DO #2: The getData () Function Write a function named getData () that accepts the names of two (2) files to process as arguments. The getData () function should perform the following: Read the data from the first file (ie: pulsarsl . dat) Read the data from the first file (ie: strengths1 . dat) Creates a new, empty List Combines the line-by-line values read from each file Appends the combined value to the List Repeats until all values have been combined and added to the List Closes both files . Return the List of combined values TO DO #3: The main () Function Write a function named main ( ) that performs the following: Displays a description of the program's purpose Prompts the user for two (2) filenames to process o NOTE: Your program should be flexible, allowing the user to enter any two filenames. Submissions will be tested with multiple different pairs of files to ensure that they meet this requirement . Call the getData () function providing the two (2) filenames as arguments and assign the returned List to a variable Use a for loop to display the first 10 entries of the List on a single row separated by commas

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Programming questions