In most countries, personal identification information such as name and surname are considered immutable and often...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
In most countries, personal identification information such as name and surname are considered immutable and often require legal proceedings to change. On the other hand, information like height, age, and weight can fluctuate and be updated more freely. Suppose you're tasked with creating a secure system that enforces these rules: 1. Name and surname are immutable once they are set. They cannot be changed without legal authorization. 2. Blood type, once recorded, should not change as it is a biological attribute. 3. Height, age, and weight are considered mutable attributes. They can change due to various reasons (like growth, aging, or diet) and thus the system should allow for updating this information. Write a Java program that: Uses Java Modifiers and Immutable Classes to protect the name, surname, and blood type from being altered. • Encapsulates mutable fields such as height, age, and weight, allowing these to be changed through public methods. • Uses an array of objects to manage and demonstrate changes for multiple Person instances within your program. Provide a Main class that demonstrates creating several Person objects with initial information, changing the mutable fields, and trying to change the immutable fields (which should not be allowed and demonstrate immutability). Hint: You should use Java Modifiers, Immutable Classes, Encapsulation, Array of Objects Note That: Answers without using Classes will not be evalauted. In most countries, personal identification information such as name and surname are considered immutable and often require legal proceedings to change. On the other hand, information like height, age, and weight can fluctuate and be updated more freely. Suppose you're tasked with creating a secure system that enforces these rules: 1. Name and surname are immutable once they are set. They cannot be changed without legal authorization. 2. Blood type, once recorded, should not change as it is a biological attribute. 3. Height, age, and weight are considered mutable attributes. They can change due to various reasons (like growth, aging, or diet) and thus the system should allow for updating this information. Write a Java program that: Uses Java Modifiers and Immutable Classes to protect the name, surname, and blood type from being altered. • Encapsulates mutable fields such as height, age, and weight, allowing these to be changed through public methods. • Uses an array of objects to manage and demonstrate changes for multiple Person instances within your program. Provide a Main class that demonstrates creating several Person objects with initial information, changing the mutable fields, and trying to change the immutable fields (which should not be allowed and demonstrate immutability). Hint: You should use Java Modifiers, Immutable Classes, Encapsulation, Array of Objects Note That: Answers without using Classes will not be evalauted.
Expert Answer:
Answer rating: 100% (QA)
Below is an example Java program that meets the specified requirements The program defines an immutable class PersonInfo for name surname and blood type and a mutable class MutableAttributes for heigh... View the full answer
Related Book For
Smith and Roberson Business Law
ISBN: 978-0538473637
15th Edition
Authors: Richard A. Mann, Barry S. Roberts
Posted Date:
Students also viewed these programming questions
-
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...
-
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...
-
In Figure, a square of edge length 20.0 cm is formed by four spheres of masses m1 = 5.00 g, m2 = 3.00 g, m3 = 1.00 g, and m4 = 5.00 g. In unit-vector notation, what is the net gravitational force...
-
A soap bubble (n = 1.33) is floating in air. If the thickness of the bubble wall is 115 nm, what is the wavelength of the light that is most strongly reflected?
-
There are 5,280 feet in a mile. Round answers to the nearest unit. a. How many miles does a car traveling at 65mi/h go in one hour? b. How many feet does a car traveling at 65 mi/h go in one hour? c....
-
In February 2014, defendant Ibrahim M. Shihadeh, d/b/a Creative Designs Kitchen and Baths, agreed to purchase 25% of his anticipated natural gas needs at a fixed price for the 201415 and 201516...
-
Below are selected T-accounts for the RunnerTech Company. Below are selected T-accounts for the RunnerTech Company. Required: Complete the following journal entries and answer the following...
-
1-2. Draw graphs of the following functions using transformations: 1. y = 2x-1 x-2' 2. y log2x+1|- 3.
-
Propagas is used in some central heating systems where natural gas is not available. It burns according to the following equation: a. What are the chemical names for propagas and natural gas? b....
-
Find the all singular points for given differential equations and classify them: (x+x-2)y" + (x + 1)y' + 2y = 0
-
BioElectroMechanical Systems (BEMS) is a start-up company with high potential and little available cash. They obtain $500,000 for necessary technology from a venture capitalist who charges them 24...
-
What is the smallest integer-valued annual compound interest that will result in an investment tripling in value in less than or equal to 10 years?
-
How much will a $25,000 investment today be worth in 10 years if it earns 7 percent annual compound interest?
-
You are offered $500 now plus $500 one year from now. You can earn 6 percent per year on your money. a. It is suggested that a single fair amount be paid now. What do you consider fair? b. It is...
-
You want to have $15 million available when you retire in 40 years (if you think that is exorbitant, wait until you learn about inflation in Chapter 12). If your money can grow in a high-performing...
-
What noise voltage will be generated across a 10KO resistor un der the following condition: a. T= 20C, fmin = 1MHZ, fmax = 4MHZ QUESTION 2 If a certain amplifier has an input noise power of 1uW and...
-
In July 2013, cnet.com listed the battery life (in hours) and luminous intensity (i. e., screen brightness, in cd/m2) for a sample of tablet computers. We want to know if screen brightness is...
-
In 1969 a deed for land in Pitt County was executed and delivered by Joel and Louisa Tyson unto M. H. Jackson and wife Maggie Jackson, for and during the term of their natural lives and after their...
-
This is an action by purchasers of 5 percent convertible subordinated fifteen year debentures of BarChris Construction Corporation (BarChris). * * * The action is brought under Section 11 of the...
-
Donald J. Richardson, Grove L. Cook, and Wayne Weaver were stockholders of Major Oil. They brought a direct action, individually and on behalf of all other stockholders of Major, against certain...
-
A running mountain lion can make a leap 10.0 m long, reaching a maximum height of 3.0 m. a. What is the speed of the mountain lion just as it leaves the ground? b. At what angle does it leave the...
-
The moon completes one (circular) orbit of the earth in 27.3 days. The distance from the earth to the moon is 3.84 10 8 m. What is the moons centripetal acceleration?
-
A soccer player takes a free kick from a spot that is 20 m from the goal. The ball leaves his foot at an angle of 32, and it eventually hits the crossbar of the goal, which is 2.4 m from the ground....
Study smarter with the SolutionInn App