Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

Fix my code package employeeInfo; import java.io . * ; import java.util.Scanner; public class Employee { public static void main ( String [ ] args

Fix my code package employeeInfo; import java.io . * ; import java.util.Scanner; public class Employee { public static void main ( String [ ] args ) throws FileNotFoundException { / / Try block to check for exceptions try ( Scanner inFile = new Scanner ( new File ( " employee _ data.txt " ) ) ) { inFile.useDelimiter ( " " ) ; double idNumber, hourlyRate, hoursWorked, grossPay; String employeeName; System.out.printf ( " % - 15 s % - 15 s % s " , "Employee","ID# " , "Gross Pay" ) ; System.out.printf ( " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - " ) ; while ( inFile . hasNext ( ) ) { employeeName = inFile.next ( ) ; idNumber = Double.parseDouble ( inFile . next ( ) ) ; hourlyRate = Double.parseDouble ( inFile . next ( ) ) ; hoursWorked = Double.parseDouble ( inFile . next ( ) ) ; grossPay = hourlyRate * hoursWorked; System.out.printf ( " % - 15 s % - 15 s$ % . 2 f " , employeeName, idNumber, grossPay ) ; } } } } Exception in thread "main" java.lang.NumberFormatException: For input string: " # 824 " at java.base / jdk . internal.math.FloatingDecimal.readJavaFormatString ( FloatingDecimal . java: 2054 ) at java.base / jdk . internal.math.FloatingDecimal.parseDouble ( FloatingDecimal . java: 110 ) at java.base / java . lang.Double.parseDouble ( Double . java: 651 ) at Employee / employeeInfo . Employee.main ( Employee . java: 26 )

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_2

Step: 3

blur-text-image_3

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

Visual Basic6 Database Programming

Authors: John W. Fronckowiak, David J. Helda

1st Edition

0764532545, 978-0764532542

More Books

Students explore these related Databases questions