In Fig. 8.8, class Employees instance variables are never modified after theyre initialized. Any such instance variable
Question:
In Fig. 8.8, class Employee’s instance variables are never modified after they’re initialized. Any such instance variable should be declared final. Modify class Employee accordingly, then compile and run the program again to demonstrate that it produces the same results.
Fig. 8.8
Transcribed Image Text:
I // Fig. 8.8: Employee.java 2 // Employee class with references to other objects. 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 public class Employee { } private String firstName; private String lastName; private Date birthDate; private Date hireDate; // constructor to initialize name, birth date and hire date public Employee (String firstName, String lastName, Date birthDate, Date hireDate) { this.firstName = firstName; this.lastName = lastName; this.birthDate = birthDate; this.hireDate= hireDate; } // convert Employee to String format public String toString() { return String.format ("%s , %s Hired: %s Birthday: %s", lastName, firstName, hireDate, birthDate); }
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 25% (4 reviews)
Based on the code provided from the image and the instructions to declare an instance variable as final you need to initialize it once and only once I...View the full answer
Answered By
Ankur Gupta
I have a degree in finance from a well-renowned university and I have been working in the financial industry for over 10 years now. I have a lot of experience in financial management, and I have been teaching financial management courses at the university level for the past 5 years. I am extremely passionate about helping students learn and understand financial management, and I firmly believe that I have the necessary skills and knowledge to effectively tutor students in this subject.
4.80+
2+ Reviews
10+ Question Solved
Related Book For
Java How To Program Late Objects Version
ISBN: 9780136123712
8th Edition
Authors: Paul Deitel, Deitel & Associates
Question Posted:
Students also viewed these Computer science questions
-
How does the integration of positive psychology principles, such as strengths-based approaches and flow theory, contribute to the enhancement of motivation and well-being in individuals and...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
This assignment reviews object-oriented programming concepts such as classes, methods, constructors, accessor methods, and access modifiers. It makes use of an array of objects as a class data...
-
Argon gas enters a constant cross-sectional area duct at Ma1 = 0.2, P1 = 320 kPa, and T1 = 400 K at a rate of 1.2 kg/s. Disregarding frictional losses, determine the highest rate of heat transfer to...
-
For the case in Prob. 17.1, calculate the skin friction drag accounting for transition. Assume the transition Reynolds number = 5 x 105.
-
Freddy Flint owns a small retail business called Flint's Fantasy. The cash account has a balance of $20,000 on July 1. The following transactions occurred during July: July 1 Issued Check No. 414 in...
-
According to the American Veterinary Medical Association (AVMA), 38.4% of households in the United States own a dog as a pet (AVMA website). Suppose that a company that sells dog food would like to...
-
Pan Corporation acquired 100 percent of Sal Corporation's outstanding voting common stock on January 1, 2011, for $660,000 cash. Sal's stockholders' equity on this date consisted of $300,000 capital...
-
After being business for 8 years, a customer gets scalded when a server accidentally spills hot espresso on them. The customer successfully sues your BizCafe for $200,000. How would this be handled...
-
The North American emergency response service, 9-1-1, connects callers to a local Public Service Answering Point (PSAP). Traditionally, the PSAP would ask the caller for identification...
-
Create a class TicTacToe that will enable you to write a program to play Tic-Tac-Toe. The class contains a private 3-by-3 two-dimensional array. Use an enum type to represent the value in each cell...
-
Explain how taking on the role of helper improves the self-image of the helper.
-
7. The base of a record player is a disk that has a mass of 2 kg and a diameter of 34 cm. A child spins it so it rotates at a constant rate of 50 times a minute. Neglect friction and all that stuff...
-
209 BOX. 4. A painter is on a scaffold that hangs by two ropes. The scaffold weighs 2500 N, and the painter weighs 800 N. The breaking point of each rope is 2100 N. 0 a. 1 m 5 m 6 m If the painter...
-
An electron that is moving through a uniform magnetic field has a velocity v = (60 km/s ) i + 47 km/s ) j when it experiences a force F = (-3.60010 -15 N ) i + (4.59610 -15 N ) j due to the magnetic...
-
In a top - secret laboratory, a team of brilliant scientists was conducting experiments on electric charges. They set up a triangle and carefully positioning three charges of 1 . 0 1 . 0 C each...
-
physical quantities m, r, u, a, and t with dimensions [m] = M, [r]= L, [v] =LT, [a] = LT-2, and [t] = T. Enter the dimensional expression of the quantity on the right-hand side of each equation. Your...
-
A refrigerator used by a meat processor has a cost of $198,500, an estimated residual value of $30,500, and an estimated useful life of 15 years. What is the amount of the annual depreciation...
-
The value of a share of common stock depends on the cash flows it is expected to provide, and those flows consist of the dividends the investor receives each year while holding the stock and the...
-
How big is the MAC address space? The IPv4 address space? Tue IP6 address space?
-
In Section 6.3, we provided an outline of the derivation of the efficiency of slotted ALOHA. In this problem well complete the derivation. a. Recall that when there are N active nodes, the efficiency...
-
In this problem, we explore some of the properties of the CRC. For the generator G (= 1001) given in Section 6.2.3. Answer the following questions. a. Why can it detect any single bit error in data...
-
Explain the outcomes. In a complete paragraph for each graph, explain how your graph illustrates the news event. Describe what changed and why. Include the one element of either TRIBE or ROTTEN that...
-
Summarize your conclusions about how amenities affect incomes and real-estate prices. Although some conclusions are ambiguous, it is possible to offer a clear-cut statement when the effect of...
-
A block with mass m = 14 kg rests on a frictionless table and is accelerated by a spring with spring constant k = 4244 N/m after being compressed a distance x 1 = 0.528 m from the spring's...
Study smarter with the SolutionInn App