-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSem2_T3_28.java
More file actions
27 lines (23 loc) · 882 Bytes
/
Sem2_T3_28.java
File metadata and controls
27 lines (23 loc) · 882 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import java.io.*;
// one emp.txt with first name, last name & salary read this file then store it
// in tax.txt file with first name, last name & tax(10%).
public class Sem2_T3_28 {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new FileReader("D:\\emp123.txt"));
BufferedWriter bw = new BufferedWriter(new FileWriter("D:\\tax123.txt"));
String s = br.readLine();
String a[];
while (s != null) {
a = s.split(" - ", 2);
String name = a[0];
Double sal = Double.parseDouble(a[1]);
Double tax = (0.10) * (sal);
String t = tax + " ";
bw.write(name + " " + t);
bw.newLine();
s = br.readLine();
}
bw.flush();
br.close(); bw.close();
}
}