write a Java program calculating the tax owed be these ceos.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Please help I a receiving a lot of errors So this assignment is a ceo assignment. We are supposed to a write a Java program calculating the tax owed be these ceos. The test file is below and the code itself is also below
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: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
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
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
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY