Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 1: (in java programing language) public class Worker implements Serializable { private int id; private int birthYear; private int salary; //3 private fields public

Question 1:

(in java programing language)

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 s1 , String s2)

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)

Remark: you may add constructer , toString (or print) method , and more set and get to the class worker but don't change or add any other code ,also make sure that the worker number is add by user (N is user-input)and also there (id , birthYear &salary = user input ) ((don't make any thing Random and also don't use linked list ))

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

Step: 3

blur-text-image

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

DNA Databases

Authors: Stefan Kiesbye

1st Edition

0737758910, 978-0737758917

More Books

Students also viewed these Databases questions

Question

LO5 Describe job analysis and the stages in the process.

Answered: 1 week ago