Create a class called Worker. Make sure you write a description of your new Class in...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Create a class called Worker. Make sure you write a description of your new Class in the comments, with your name as author and date as the last date you worked on this exercise. Add definitions for the following fields: A name field of type String An workerld field of type int A wage field of type double A fullTime field of type boolean Write a constructor for your Worker class that takes four parameters - the first of type String called myName, the second of type int called myWorkerld, the third of type double called myWage, and the fourth of type boolean called isFullTime. Set the initial values of the corresponding fields using the constructor. Write an accessor method called getName that returns the value of the name field. 2 Write a mutator method called setWorkerld that takes a single parameter of type int and sets the value of the employeeld field. Work out what other accessor and mutator methods would be useful for this Class and add them. You should be able to get and set all fields in the Class. Write a method called printDetails, which prints out all the details of an Worker object. You must take into account the fullTime status and print a line saying either that the employee is fulltime or the employee is not fulltime. For example, if: The name field holds the value "John Smith" The workerld field holds the value 123456 The wage field holds the value 25.40 . The fullTime field holds the value false Then the printDetails method would print out the following: The name of the worker is John Smith. The worker id is 123456. The wage of the worker is $25.40 per hour. The employee is not full-time. If the full-time field holds the value True, then the printDetails method would print out the following: The name of the worker is John Smith. The worker id is 123456. The wage of the worker is $25.40 per hour. The worker is full-time. Please Note: In the above examples, the name, workerld, wage and whether the worker is full-time or not (in blue) will change based on the values the fields hold. However, you must print the remainder of the statements exactly as in the above examples. Create a class called Worker. Make sure you write a description of your new Class in the comments, with your name as author and date as the last date you worked on this exercise. Add definitions for the following fields: A name field of type String An workerld field of type int A wage field of type double A fullTime field of type boolean Write a constructor for your Worker class that takes four parameters - the first of type String called myName, the second of type int called myWorkerld, the third of type double called myWage, and the fourth of type boolean called isFullTime. Set the initial values of the corresponding fields using the constructor. Write an accessor method called getName that returns the value of the name field. 2 Write a mutator method called setWorkerld that takes a single parameter of type int and sets the value of the employeeld field. Work out what other accessor and mutator methods would be useful for this Class and add them. You should be able to get and set all fields in the Class. Write a method called printDetails, which prints out all the details of an Worker object. You must take into account the fullTime status and print a line saying either that the employee is fulltime or the employee is not fulltime. For example, if: The name field holds the value "John Smith" The workerld field holds the value 123456 The wage field holds the value 25.40 . The fullTime field holds the value false Then the printDetails method would print out the following: The name of the worker is John Smith. The worker id is 123456. The wage of the worker is $25.40 per hour. The employee is not full-time. If the full-time field holds the value True, then the printDetails method would print out the following: The name of the worker is John Smith. The worker id is 123456. The wage of the worker is $25.40 per hour. The worker is full-time. Please Note: In the above examples, the name, workerld, wage and whether the worker is full-time or not (in blue) will change based on the values the fields hold. However, you must print the remainder of the statements exactly as in the above examples.
Expert Answer:
Answer rating: 100% (QA)
java Description This class represents a worker with basic information such as name worker ID wage a... View the full answer
Related Book For
Java How To Program Late Objects Version
ISBN: 9780136123712
8th Edition
Authors: Paul Deitel, Deitel & Associates
Posted Date:
Students also viewed these programming questions
-
CANMNMM January of this year. (a) Each item will be held in a record. Describe all the data structures that must refer to these records to implement the required functionality. Describe all the...
-
Write MATLAB code of the question. Do all parts and show code with comments and also attach a screenshot of code and outputs. Using the results of Problem 4.13, verify the following properties of WN...
-
Pregnancy testing. In a random sample of 200 women who suspect that they are pregnant, 100 turn out to be pregnant. A new pregnancy test given to these women indicated pregnancy in 92 of the 100...
-
Calculate the carbon footprint of a household, i.e. the total annual CO emissions of the household, assuming the household annually consumes (1) 1220 (1+12) kWh electricity 8 (the CO emission factor...
-
Consider boiling of water under sea-level conditions in a copper vessel. Calculate and plot the heat flux vs. \(\Delta T\) diagram for water at three different pressures. Show the temperature at the...
-
The shareholders of the Pickwick Paper Company need to elect five directors. There are 200,000 shares outstanding. How many shares do you need to own to ensure that you can elect at least one...
-
Effects of Adjusting Entries on the Accounting Equation Four adjusting entries are shown below. a. Interest Expense 1,595 Interest Payable 1,595 b. Interest Receivable 1,050 Interest Income 1,050 c....
-
Using the standard 22number tutorial with unchanged code, I can see a spinning cube. I then set the following variables as shown below. GLfloat num9_lookAtX = 0; GLfloat num10_lookAtY = 0; GLfloat...
-
If the frequency is doubled to \(80 \mathrm{kHz}\) and the current is kept the same, what will be the peak out-of-phase voltage? A. \(0.32 \mathrm{~V}\) B. \(0.16 \mathrm{~V}\) C. \(0.080...
-
The plane of a loop of wire is perpendicular to a magnetic field. Rank, from greatest to least, the magnitudes of the loop's induced emf for the following situations: A. The magnetic field strength...
-
The aluminum wire in a high-voltage transmission line is \(2.7 \mathrm{~cm}\) in diameter. It is designed to carry a current of \(1100 \mathrm{~A}\). What is the voltage drop across a...
-
The magnetic field at the earth's surface can vary in response to solar activity. During one intense solar storm, the vertical component of the magnetic field changed by \(2.8 \mu \mathrm{T}\) per...
-
A long wire used as a heating element carries a current of \(0.80 \mathrm{~A}\). It dissipates \(6.0 \mathrm{~W}\) for every meter of length. What is the electric field strength inside this wire?
-
(1) Briefly explain what is meant by: (a) A Transparency Report (b) The Audit Firm Governance Code. (2) Identify which audit firms must: (a) Publish a Transparency Report; (b) Comply with the Audit...
-
Ask students to outline the reasons why the various elements of culture (social structures and control systems, language and aesthetics, religion and other belief systems, educational systems, etc.)...
-
Sketch and explain a simple diagram to match your exhibit.
-
a. Write out and explain the equation for volume breakeven. b. What is the difference between accounting breakeven and economic breakeven?
-
a. What is profit analysis, also known as cost-volume-profit (CVP) analysis? b. Why is profit analysis so useful to healthcare managers? c. What is a profit and loss (P&L) statement?
Study smarter with the SolutionInn App