Tines+; 1 import java, to.File; 2 import java. Lo.FileNotFoundExcept ion; 3 import java. to.FLleriter; 4 import java. io.10Exception; 5 import java.util.ArrayList; 6 import java.util.Scanner; 39 40 41 fileReader.close( ); 42 } catch (FileNotFoundExcept Lon e) { System.out.printin( "File with given name not found" )3; e.printStackTracel); 43 44 45 8 public class Main 46 47 static public double calcTax( double salary , double taxRate) try ( 10 48 Filewriter mywriter = new Filewriter("taxinfo.txt", true)) 49 11 12 double taxowed e taxowed (salary taxtate)/ 100; return taxowed; 13 50 System.out. printin( "Records started in file...."); for (int i ; t< name.size( ); i++) 14 51 15 52 16 public static void nain(String[] args) throws IOException 53 String nameP nane.get(); String companyName - company_name.get(i); double salaryP- salary.get(i); double taxRate , taxOwed 17 54 18 55 19 Arraylistdoubles salary new ArrayListdouble>() ArrayListestring nane new ArrayList(); int lines- 1; 56 20 57 21 58 Lf(salary.get(i) 100000e0){ taxRate 40; 22 23 59 60 } elsel taxRate- 53; 24 try { File myFLle new FLlel taxpayer.txt"); 25 61 26 62 27 Scanner fileReader = new Scanner(myFilel; while (fileReader.hasNextLinel )) ( taxowed = calcTaxt salary-get(i), taxRate); string tax String.valueof(taxOwed); 63 28 64 29 string data = fileReader.nexti inel ); 65 30 myir iter.write( nameP"\n"companyNane"\nsalaryP\n+tax+"\n): 31 LT(Lines 3 1H 66 32 nane. add( data): Jelse if(1ines 3 2H 67 System.out.printIn( nameP-Vn+companyName; AEE 68 34 conpany_nane. add( data): 69 35 Jelset 70 36 double sal Double.parseDoublet datal; salary.addi sal); 71 } 72 37 38
Tines+; 1 import java, to.File; 2 import java. Lo.FileNotFoundExcept ion; 3 import java. to.FLleriter; 4 import java. io.10Exception; 5 import java.util.ArrayList; 6 import java.util.Scanner; 39 40 41 fileReader.close( ); 42 } catch (FileNotFoundExcept Lon e) { System.out.printin( "File with given name not found" )3; e.printStackTracel); 43 44 45 8 public class Main 46 47 static public double calcTax( double salary , double taxRate) try ( 10 48 Filewriter mywriter = new Filewriter("taxinfo.txt", true)) 49 11 12 double taxowed e taxowed (salary taxtate)/ 100; return taxowed; 13 50 System.out. printin( "Records started in file...."); for (int i ; t< name.size( ); i++) 14 51 15 52 16 public static void nain(String[] args) throws IOException 53 String nameP nane.get(); String companyName - company_name.get(i); double salaryP- salary.get(i); double taxRate , taxOwed 17 54 18 55 19 Arraylistdoubles salary new ArrayListdouble>() ArrayListestring nane new ArrayList(); int lines- 1; 56 20 57 21 58 Lf(salary.get(i) 100000e0){ taxRate 40; 22 23 59 60 } elsel taxRate- 53; 24 try { File myFLle new FLlel taxpayer.txt"); 25 61 26 62 27 Scanner fileReader = new Scanner(myFilel; while (fileReader.hasNextLinel )) ( taxowed = calcTaxt salary-get(i), taxRate); string tax String.valueof(taxOwed); 63 28 64 29 string data = fileReader.nexti inel ); 65 30 myir iter.write( nameP"\n"companyNane"\nsalaryP\n+tax+"\n): 31 LT(Lines 3 1H 66 32 nane. add( data): Jelse if(1ines 3 2H 67 System.out.printIn( nameP-Vn+companyName; AEE 68 34 conpany_nane. add( data): 69 35 Jelset 70 36 double sal Double.parseDoublet datal; salary.addi sal); 71 } 72 37 38
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
Please help I am having errors
![Tines;
1 import java. Lo.File;
2 import java. Lo.FileNotFoundExcept ion;
3 import java. to.FLleriter;
import java. io.IOExcept ion;
5 import java.util.ArrayList;
6 import java.util.Scanner;
39
40
41
fileReader.close( );
} catch (FLleNotFoundExcept Lon e) {
System.out.printin( "File with given name not found" );
e.printStackTracel );
4
42
43
44
45
8 public class Main
46
47
10
static public double calcTax(double salary, double taxRate)
try (
48 Filewriter mywriter = new Filewriter("taxinfo.txt",true))
49
11
12
double taxOwed ;
13
taxowed- (salary taxRate) / 100;
return taxowed;
50
System.out. printin( "Records started in file. ");
for (int i ; t< name.sizel ); i++)
14
51
15
52
16
public static void nain(String[] args) throws I0Exception
String name nane.get(i);
String companyNane company_name.get(i);
double salaryP- salary.get(i);
double taxRate , taxOwed
53
17
54
18
55
19
Arraylistdouble> salary= new ArrayListoouble>{)
ArrayListstring nane = new ArrayListestring();
ArrayListestring company_nane - new Arrayl ist<string();
int lines- 1;
56
57
21
58 v
Lf(salary.get(i) 100000e0){
taxRate 40;
} else(
22
23
59
24
try {
File myFLle new FLlel taxpayer.txt");
60
25
61
taxRate - 533B
26
62
27
Scanner fileReader = new Scanner(myFilel;
while (fileReader.hasNextLine( )) (
63
taxowed = calcTaxt salary-get(i), taxRate);
string tax String.valueof(taxOwed);
28
64
29
String data = fileReader.nextLinel );
65
30
myir iter.write( nameP"\n"+companyName"\nsalaryp\n+tax+"\n):
31
if(tines 3 1H
66
32
nane. add( data):
Jelse it(lines
conpany_name. add( data);
Jelset
67
System.out.print In( nameP\n+companyName);
33
3 -2 H
68
34
69
35
70
36
double sal 0ouble.parseDoubtel data);
salary.addi sal);
71 }
72
37
38](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F6bec9b77-f984-411a-b777-1e2789807259%2F1de86e20-83b2-46a4-a413-38e00ea696cc%2Fdjau0tg_processed.jpeg&w=3840&q=75)
Transcribed Image Text:Tines;
1 import java. Lo.File;
2 import java. Lo.FileNotFoundExcept ion;
3 import java. to.FLleriter;
import java. io.IOExcept ion;
5 import java.util.ArrayList;
6 import java.util.Scanner;
39
40
41
fileReader.close( );
} catch (FLleNotFoundExcept Lon e) {
System.out.printin( "File with given name not found" );
e.printStackTracel );
4
42
43
44
45
8 public class Main
46
47
10
static public double calcTax(double salary, double taxRate)
try (
48 Filewriter mywriter = new Filewriter("taxinfo.txt",true))
49
11
12
double taxOwed ;
13
taxowed- (salary taxRate) / 100;
return taxowed;
50
System.out. printin( "Records started in file. ");
for (int i ; t< name.sizel ); i++)
14
51
15
52
16
public static void nain(String[] args) throws I0Exception
String name nane.get(i);
String companyNane company_name.get(i);
double salaryP- salary.get(i);
double taxRate , taxOwed
53
17
54
18
55
19
Arraylistdouble> salary= new ArrayListoouble>{)
ArrayListstring nane = new ArrayListestring();
ArrayListestring company_nane - new Arrayl ist<string();
int lines- 1;
56
57
21
58 v
Lf(salary.get(i) 100000e0){
taxRate 40;
} else(
22
23
59
24
try {
File myFLle new FLlel taxpayer.txt");
60
25
61
taxRate - 533B
26
62
27
Scanner fileReader = new Scanner(myFilel;
while (fileReader.hasNextLine( )) (
63
taxowed = calcTaxt salary-get(i), taxRate);
string tax String.valueof(taxOwed);
28
64
29
String data = fileReader.nextLinel );
65
30
myir iter.write( nameP"\n"+companyName"\nsalaryp\n+tax+"\n):
31
if(tines 3 1H
66
32
nane. add( data):
Jelse it(lines
conpany_name. add( data);
Jelset
67
System.out.print In( nameP\n+companyName);
33
3 -2 H
68
34
69
35
70
36
double sal 0ouble.parseDoubtel data);
salary.addi sal);
71 }
72
37
38

Transcribed Image Text:1 Louis, Vachon, National Bank of Canada, 10500000
2 Randall, Eresman, EnCana Corp.,
10300000
3 Thomas, Glocer, Thomson Reuters Corp., 36000000
4 Jim, Shaw, Shaw Communications Inc., 8200000
5 Ted, Rogers, Rogers Communications Inc., 21500000
J. M., Lipton, Nova Chemicals Corp., 19800000
George, Cope, BCE Inc., 19600000
8 Harold, Kvisle, TransCanada Corp., 8600000
9 Robert, Brown, CAE Inc., 17300000
10 William, Doyle, Potash Corp. of Saskatchewan, 17000000
11 Allan, Leighton, Loblaw Cos. Ltd./Weston, 8800000
12 Hunter, Harrison, Canadian National Railway Co., 13400000
13 John, Manzoni, Talisman Energy Inc., 8800000
14 Dominic, D'Alessandro, Manulife Financial Corp., 13300000
15 Richard, Waugh, Bank of Nova Scotia, 9200002
16 Stephen, Wetmore, Bell Aliant Regional Com. Income Fund, 11600000
17 Serafino, Iacono (co-chairman), Pacific Rubiales Energy Corp., 11300001
18 Miguel, de la Campa (co-chairman), Pacific Rubiales Energy Corp., 11300002
19 Jeffrey, Orr, Power Financial Corp., 11300003
20
Jean-Claude, Gandur, Addax Petroleum Corp., 11200000
21 Edmund, Clark, Toronto-Dominion Bank, 11100001
22 Tye, Burt, Kinross Gold Corp.,
23 Frank, Stronach (Chairman), Magna International Inc.,
Ron, Brenneman, Petro-Canada, 9200000
25 Kevin, McArthur, Goldcorp Inc., 8700000
26 Craig, H. Muhlhauser, Celestica Inc, 8700001
27 Eugene, McBurney, (Chairman) GMP Corp.,
28 Michael, Wilson, Agrium Inc., 9200001
29 Gregory, Wilkins, Barrick Gold Corp., 8900000
11100002
10800000
24
8300000
30
Mr., Wray, Peel District School Board, 121000000
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 5 steps with 6 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education