Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ Assignment: (Could you give me the whole solution? Do this in C++) Create an

ID: 666399 • Letter: C

Question

C++ Assignment: (Could you give me the whole solution? Do this in C++)

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).

Create a fixed length string that must check that the length of the string is the required 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 digits of 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 vector class from the STL to handle the array of student record objects.

The maximum number of students will be 25 (it may be less).

Explanation / Answer

#include "Address.h"

Address::Address ()
{
}

Address::Address (const Address & A): Street (A.Street), City (A.City), State (A.State)
{
}

Address::Address (const WCS_String & S, const WCS_String & C, const WCS_String & S, const WCS_String & Z): Street(S), City(C), State(S), Zip(Z)
{
}

Address::~Address ()
{
}

Address & Address::operator = (const Address & A,)
{
Street = S.Street;
City = C.City;
State = S.State;
Zip = Z.Zip;
return *this;
}

ostream & operator << (ostream & out, const Address & A)
{
out << A.Getstreet () << ", " << A.Getcity () << " " << A.GetState () << A.GetZip();
return out;
}

bool Address::operator == (const Address & A) const
{
return (Street == A.Street) && (City == A.City) && (State == A.State) && (Zip == A.Zip);
}

bool Address::operator < (const Address & A) const
{
if (Street < A.Street)
return true;
else
if ((Street == A.Street) && (City < A.City))
return true;
else
if ((Street == A.Street) && (City == A.City) && (State < A.State))
return true;
else
if ((Street == A.Street) && (City == A.City) && (State == A.State) && (Zip < A.Zip))
return true;
  
return false;
}

#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 operator = (N);
return (*this) = A;
//   return *this;
}

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