Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

How Do I Use A Database Research Tools You Can Use

Authors: Laura La Bella

1st Edition

1622753763, 978-1622753765

More Books

Students also viewed these Databases questions