Semester Project

I am having a bit of problems with my project, it is listed below.

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

I have the Student Record working. The Address is giving me some errors that i would love help on. Also I would love some ideas on how to wright the ID number. Thanks for all the help! Code is listed below.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#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;
}


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#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 
Topic archived. No new replies allowed.