1. Engineering
  2. Computer Science
  3. so ive posted this question before and didnt get a...

Question: so ive posted this question before and didnt get a...

Question details
So I’ve posted this question before and didnt get a clear answer. The person told me to put myinput.txt in the same directory as that of Stats.java file. How do I put it in the same directory. This is my first week coding so please try to explain it in simple terms so that I can understand. Thank You.

ecipse-workxpace-HomeWork2/a/homework2/Stats java Eclipse IDt e Edit Source Refactor Navigate Search Project Run Window Help ฏิ Stats.java Et 4 public class Stats ( 6Adding TOException to main aethod for outputfile. public static void main(Stringll args) throus T0Exception ( / /Declaring variables int IDNumber, rightAns,wrongAns, answered, onitted, grade, numberOf Students int maxGradetD , maxGrade , maxPerID double rightAnspercent, maxPercent -1.0 String message null, oMessage ull 1e 12 13 14 15 //open input File File nyfile-new File(myinput.txt) 16 17 18 19 20 21 //Creating scanner object. Scanner inputFile new Scanner(myfile); / /Scanner inputFile new Scanner (System.in); /read from console //Creating outputFile using Printwriter class. Printuriter outputfile 23 24 25 26 27 28 29 //Attaching object to a file and opening file. outputFile new Printwriter(myoutput.txt) /iprinting Table Header outputFile.printin( titicititititititittttExan Statisticsin) outputFile.printin(Student ID tRighttwrong\tAnswered tOmittedt itGrade t 31 Percent ititittMessagetieleititomitted Message) D Console S terminated. Stats (1) İlava AppkationCprogramF les laval re-10aabin ymaw exe Clana 2019,24101 PM) Exception in thread main-iavadonientrounderception: myǐnput.txt (The system cannot find the file specified) at java.base/java, io.FileInputStream.opene(Native Method) at java.base/java. io.FileInputStream,open (Unknown Source) at java.base/java.Lo.PileInputStream.<init(Unknown Source at java.base/java.util.Scanner.cinit>(Unknown Source) at Homework2/homework2.Stats.main(Stats java:19) Smart Insert O Type here to search
Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution