Answered step by step
Verified Expert Solution
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:
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 IO 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 : a txt file contains a list of integers. declare inFile as: File inFile new File args
II Output:
a outFile args : declare outFile as: File outFile new File args
step : inFile open args ie Scanner inFile new Scannernew FileReader
outFile open args ie FileWriter outFile new FileWriter args ;
step : largest
step : data read an integer at a time from inFile ie data inFile. next Int;
outFile output data to outFile ie outFile.write data
step : if data largest largest data
step : repeat step to step until inFile is empty.
step : outFile write "The largest integer in the input file is largest.
Step : close inFile and outFile
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started