Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Im having dofficulty with this homework question. I dont know how to get the code to read the data provided in the way this homework

Im having dofficulty with this homework question. I dont know how to get the code to read the data provided in the way this homework requires me to do so. The instructions confuse me. This is the data provided:
91322
702899912
13314
415
21323724825
226127
5382991
9191
730361
637
213
213388
9132273213495
16
702
Given a file that contains a list of integers, not in particular format. The program will find the largest integers among the integers in the input file, and outputs the largest integer found. This project is for you to practices basic file I/O in Java via the implementation of this simple algorithm: If you know Java, this project can be done less than an hour.
I. Inputs:
a) inFile (args [0]): a txt file contains a list of integers. // declare inFile as: File inFile = new File (args [0])
II. Output:
a) outFile (args [1]): // declare outFile as: File outFile = new File (args [1]).
step 0: inFile = open args [0]// i.e., Scanner inFile= new Scanner(new FileReader (args[0])
outFile = open args [1]// i.e., FileWriter outFile1= new FileWriter (args [1]);
step 1: largest =-9999
step 2: data = read an integer at a time from inFile // i.e., data = inFile. next Int();
outFile = output data to outFile // i.e., outFile.write (data)
step 3: if data > largest largest = data
step 4: repeat step 2 to step 3 until inFile is empty.
step 5: outFile = write "The largest integer in the input file is" largest.
Step 6: close inFile and outFile
image text in transcribed

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 Databases questions

Question

3.What are the Importance / Role of Bank in Business?

Answered: 1 week ago

Question

b. Where did they come from?

Answered: 1 week ago