Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Fixed the error code in my program. Need declare FileInputStream in my program. both dataOutput.txt and dataInput.txt Create a Java NetBeans project. Read the instructions

Fixed the error code in my program. Need declare FileInputStream in my program. both dataOutput.txt and dataInput.txt Create a Java NetBeans project. Read the instructions below carefully and make sure follow the steps from the instructions. Do not skip any steps. NEED TO FOLLOW THE INSTRUCTIONS( do not mixed steps). Make sure including your OUTPUT. Make sure the code will work in NetBeans IDE 8.0.2.

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Prajects Services Files Add LineNumbers vehicle ava MotorizedVehicleyava ( L Bicycletava O BattersHtttingPercentage ava est ava AddLineNumbers Java e Source Packages addline numbers 5 package addlinenumbers; 6 import java.io.FileNotFoundException; 7 import java.io.FileOutputStream; aAddLineNumbers.java Libraries 8 import java.io.FileInputStream; BattersHittingPercentage to Source Packages 9import java.io.Printwriter; 10 import java.utilScanner; 11 public class AddLineNumbers 12 13 14 15 16 17 18 19 battershittingpercentage BattersHittingPercentage.java public static void main(String[] args Libraries String ine; Scanner sc; Printwriter pw; int lineNumber; ER Source Packages E Coins java FilelnputStream("dataInput.txt"); FileInputStream fos = new sc = new Scanner( fos); Libraries CourseGradeClient EEj Source Packages pw new PrintWriter(fos); while (sc.hasNextLine)) line sc.nextLine); LineNumber++; pw.println(lineNumber+""line); 21 cour segradeclient CourseGrade.java SCourseGradeClient.java 24 25 26 27 Libraries FirstProgram main Navigator sc.close); pw.close); Members cempty 29 + catch (FileNotFoundException ex) f Add LineNumbers System.err.println(ex.getMessage System.err.println(ex.toString)) ex.printStackTrace) mainstring[] args) 31 35 Output AddLineNumbers (run) run: i > Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - variable fos is already defined in method main{java.lang.String[]) at addlinenumbers.AddLineNumbers.main AddLineNumbers.java:20) Java Result: 1 BUILD SUCCESSFUL (total tine: 1 second)

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

Recommended Textbook for

SQL Instant Reference

Authors: Gruber, Martin Gruber

2nd Edition

0782125395, 9780782125399

More Books

Students also viewed these Databases questions