Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This small project is geared to get you started on writing Object Oriented program using either Java or C++. Create a class called Person that

This small project is geared to get you started on writing Object Oriented program using either Java or C++.

Create a class called Person that will hold information about a single individual. This class should have a data section that consists of the following:

Variable Name

Data Type

firstName

string

lastName

string

address

string

The Person class should have the following mutators:

  • setFirstName(string first);

  • setLastName(string last);

  • setAddress(string address);

The Person class should have the following accessors:

  • string getFirstName();

  • string getLastName();

  • string getAddress();

The Person class should have the following constructors:

  • Person(); - default

  • Person(string first, string last); - Set other fields to an empty string

  • Person(string first, string last, string address);

Note: You must use delegating constructors to eliminate duplicate code.

Main

Create an array which will hold 5 Person classes. Pass the array to a function called getPeople which will fill out the array with information about people taken from the keyboard. Create a second function called printPeople which will take the array of Person's and print it to the console window. Please format the output so that it can be easily read and understood.

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

Deductive And Object Oriented Databases Second International Conference Dood 91 Munich Germany December 18 1991 Proceedings Lncs 566

Authors: Claude Delobel ,Michael Kifer ,Yoshifumi Masunaga

1st Edition

3540550151, 978-3540550150

More Books

Students also viewed these Databases questions