Create an application to manipulate an array of student record objects. A studen
ID: 3856595 • Letter: C
Question
Create an application to manipulate an array of student record objects. A student record will consist of a name (first, middle, and last), an ID number (9 numeric digits, cannot be more or less), an address (street, city, state, and 5 digit Zip code), and a phone number (3 digit area code and 7 digit number). The application will support an array of students. The user will be allowed to enter records from the keyboard, sort records by either name (last, first, middle) or by ID, save the records to a disk file (name supplied by user), and read the records from a disk file (name again supplied by user).Createa fixed length string that must check that the length of the string is therequired length. The fixed length class should be done as a template with the number of characters as the template argument. From this fixed length string, derive a class to hold digitsof a fixed length.Create component classes as necessary to use together to implement the student record class.Use either the array template created in an earlier lab to handle the array or you may use the vectorclass from the STL to handle the array of student record objects.The maximum number of students will be 25 (it may be less).TO TURN IN:1)An electronic copy of the .cpp and .h files in the project folder as created by Visual Studio.
Explanation / Answer
#ifndef __Name__Address__
#define __Name__Address__
#include <stdio.h>
#include "WCS_String.h"
#include <iostream>
using namespace std;
class Address
{
public:
Address();
Address (const Address &);
Address (const WCS_String &, const WCS_String &, const WCS_String &);
~Address ();
Address &Copy (const Address &);
const WCS_String &GetStreet() const;
const WCS_String &GetCity () const;
const WCS_String &GetState() const;
const WCS_String & GetZip () const;
bool SetStreet (const WCS_String &);
bool SetState (const WCS_String &);
bool SetCity (const WCS_String &);
bool SetZip (const WCS_String &);
Address &operator = (const Address &);
Bool operator ==(const Address &) const;
Bool operator < (const Address &) const;
private:
WCS_String Street;
WCS_String City;
WCS_String State;
WCS_String Zip;
};
ostream & operator << (ostream &, const Address &);
inline Address & Address::Copy (const Address & A)
{
return (*this) = A;
}
inline const WCS_String & Address::GetStreet () const
{
return Street;
}
inline const WCS_String & Address::GetState () const
{
return State;
}
inline const WCS_String & Address::GetCity () const
{
return City;
}
inline const WCS_String & Address::GetZip() const
{
return Zip;
}
inline bool Address::SetStreet (const WCS_String & S)
{
Street= S;
return true;
}
inline bool Address::SetState (const WCS_String & L)
{
State = L;
return true;
}
inline bool Address::SetCity (const WCS_String & C)
{
City = C;
return true;
}
inline bool Address::SetZip (const WCS_String & S)
{
Zip = S;
return true;
}
#endif
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.