Question: Java An Adult object has exactly 3 instance variables used to store the adults first name, last name, and age. There are 3 getter methods,

Java

An Adult object has exactly 3 instance variables used to store the adults first name, last name, and age. There are 3 getter methods, and no setter methods. The initials method returns the adults initials (i.e., the first letter of each name). The method fudgedAge returns an integer which is plus or minus 5 years of the adults age. Do not change the age. For example, if the age is 60, fudgedAge will return a random integer in the range [55,65]. Also include a toString method. No other methods are allowed.

Tester is shown below

public class Tester { public static void main(String[] args) { Adult a = new Adule("Donald", "Trump", 72); System.out.println(a.getFirst()); System.out.println(a.getLast()); System.out.println(a.getAge()); System.out.println(); System.out.println(a); System.out.println(); System.out.println(a.fudgedAge()); System.out.println(a.fudgedAge()); System.out.println(a.getAge()); System.out.println(); System.out.println("Initials: " + a.initials()); } }

Write the code that would be stored in Adult.java. Sample output is shown below.

Java An Adult object has exactly 3 instance variables used to store

WIUS. SUIDUP INIC > run Tester Donald Trump 72 Donald Trump Age: 72 Initials: DT > run Tester Donald Trump 72 Donald Trump Age: 72 75 Initials: DT

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!