this is java: Main.javause onlinegdb.com to create the codeplease show the picture of the code Write a
Fantastic news! We've Found the answer you've been seeking!
Question:
this is java: Main.javause onlinegdb.com to create the codeplease show the picture of the code
Transcribed Image Text:
Write a Person class with the following attributes: Name Age The class person should have constructors, get and set methods. Define two unchecked exceptions with constructors that take a message of String. It should pass the message to the super class. InvalidNameException InvalidAgeException Update the Person class so that set methods will check the values of the parameters. For example, the name must not be an empty string and the age must be a number between 0 and 130. If the name is empty, it should throw InvalidNameException. If the age is invalid, it should throw InvalidAgeException. The constructor should use these two set methods when initialize the instance variables with values of the parameters. Write a main class that prompts the user to create three person objects. It should handle any exceptions so that the user must enter only valid input. If an exception occurs, it should prompts for the information for that person again. Write a Person class with the following attributes: Name Age The class person should have constructors, get and set methods. Define two unchecked exceptions with constructors that take a message of String. It should pass the message to the super class. InvalidNameException InvalidAgeException Update the Person class so that set methods will check the values of the parameters. For example, the name must not be an empty string and the age must be a number between 0 and 130. If the name is empty, it should throw InvalidNameException. If the age is invalid, it should throw InvalidAgeException. The constructor should use these two set methods when initialize the instance variables with values of the parameters. Write a main class that prompts the user to create three person objects. It should handle any exceptions so that the user must enter only valid input. If an exception occurs, it should prompts for the information for that person again.
Expert Answer:
Answer rating: 100% (QA)
import javautilScanner class InvalidNameException extends RuntimeException public InvalidNameExcepti... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
Design a Java class that represents a cache with a fixed size. It should support operations like add, retrieve, and remove, and it should evict the least recently used item when it reaches capacity.
-
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 a program that takes two integer command-line arguments x and y and prints the Euclidean distance from the point (x, y) to the origin (0, 0).
-
CIBC's return on assets was 0.8% in 2015. During the same year, CIBC reported a return on common shareholders' equity of 18.7%. Has CIBC made effective use of leverage? Explain.
-
Consider the following code snippet for adding elements to a Linked List: public void add(int data) { LinkedList newNode = new LinkedList(data); if (this.node == null) // if the LL is empty node =...
-
A rectangular wing with an aspect ratio of 6 is to generate \(1000 \mathrm{lb}\) of lift when it flies at a speed of \(200 \mathrm{ft} / \mathrm{s}\). Determine the length of the wing if its lift...
-
Bond Price Movements Bond X is a premium bond making annual payments. The bond pays a 9 percent coupon, has a YTM of 7 percent, and has 13 years to maturity. Bond Y is a discount bond making annual...
-
Princess Inc. is considering a capital project with an investment of $400,000 for cash flows projected for 6 years in the amount of $70,000 with a salvage value of $40,000. Cost of capital is 10% and...
-
Assume the risk-free continuously compounded interest rate is \(4 \%\) per annum. For an asset with today's price \(A(0)=\$ 100\), you are told that its expected return is \(10 \%\) per annum and...
-
3. Find the curvature of the following: Give exact values only a) 7(1)=(21, 1, 1). b) at f(x)=sin'x, at x= R|N 1=1
-
How is the entrepreneurial process related to strategy?
-
Microsoft and Disney are just two of a growing number of organizations using internal carbon taxes in an attempt to reduce carbon emissions, and the carbon prices being used to set the internal taxes...
-
What are some of the internal causes of organizational failure?
-
What are the stages of a turnaround plan?
-
Jonas has been living in the United Kingdom for the past four years while pursuing an undergraduate degree in Economics. In each of the last four years, he has made trips back home to Germany for...
-
Using the data in E4-2 and spreadsheet software, determine: 1. The variable cost per unit, the total fixed cost, and R2. 2. The plotted data points using the graphing function. 3. Compare the results...
-
Halley's comet travels in an ellipti- cal orbit with a = 17.95 and b = 4.44 and passes by Earth roughly every 76 years. Note that each unit represents one astronomical unit, or 93 million miles. The...
-
Indicate whether each of the items listed below would be included (I) in or excluded (E) from gross income for the 2012 tax year. ________a. Welfare payments ________b. Commissions ________c. Hobby...
-
Sally hires a maid to work in her home for $250 per month. The maid is 25 years old and not related to Sally. During 2012, the maid worked 10 months for Sally. a. What is the amount of Social...
-
Marty is a sales consultant. Marty incurs the following expenses related to entertainment of his clients in 2012: Dues to a country club......................................................$4,500...
-
Two small pith balls, initially separated by a large distance, are each given a positive charge of \(5.0 \mathrm{nC}\). By how much does the electric potential energy of the two-ball system change if...
-
The negative terminal of a \(9-\mathrm{V}\) battery is connected to ground via a wire. (a) What is the potential of the negative terminal? (b) What is the potential of the positive terminal? (c) What...
-
Two metallic spheres A and B are placed on nonconducting stands. Sphere A carries a positive charge, and sphere B is electrically neutral. The two spheres are connected to each other via a wire, and...
Study smarter with the SolutionInn App