Question: Question 1: public class Worker implements Serializable { private int id; private int birthYear; private int salary; //3 private fields public int getBitrhYear ( )
Question 1: public class Worker implements Serializable { private int id; private int birthYear; private int salary; //3 private fields public int getBitrhYear ( ) { return birthYear; } public int getSalary( ) { return salary; } public void setSalary (int s) { salary = s; } } a- Write a void method that takes a string s1 representing a serial file name of Worker objects and another string s2. The method produces a new serial file (of name as the parameter s2) of all workers in input file such that the salary of workers born before 1992 is increased by 150 (other workers salary has no change). public static void changeSalary (String w) b- Write a program that reads N worker objects (N is user-input) into file: w1.ser and then call the above method changeSalaryto produce a new file: w2.ser. The program prints both files on screen (using two calls to a method printFile) //------------------------------------- Question 2: Resolve Question 1 using text files.
(in java programing language)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
