Homework Help Question & Answers
I Need Help with this using Java Programming : Class name fname lname Class variable total…
I Need Help with this using Java Programming :
Class name
fname
lname
Class variable
total Number
Constructor (no arguments)
Constructor (takes two arguments, fname and lname)
One getter method to return the fname and lname
One setter method for fname and lname
Inside Main:
Create three objects with the following names
Jill Doe
John James
Jack Smith
When creating the first object (Should not be an anonymous object)
use the argument-less constructor
Then use the setter method to assign the fname and lname
Then use the getter method to display the information for the first object
When creating the second object (Should not be an anonymous object)
use the two argument constructor to set the fname and lname
then use the getter method to display the information for the second object
When dealing with he third object (All of this should happen using one single statement)
Create an anonymous, third object using the two argument constructor. Use the getter method to retrieve fname and lname as a single string and then display the string. Remember that all of this code should be in a single statement.
Every time you add an abject increment total number by 1. This increment should only happen in the argument-less constructor’s tour. This means that if you call the two argument constructor, you have to revere to the argument-less constructor as well.
Before the end of the program, display the number of objects that were created by displaying the contents of totalNumber
Thank You