Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I really just want to know what the main function is/looks like, but everything else is appreciated. Edit: The number of records are not known,

I really just want to know what the main function is/looks like, but everything else is appreciated.

Edit: The number of records are not known, as information from the file/file path C:\tmp\cs221\hw1\hw1samplefile.txt is not given.

1.0 Overview

Pointers, Structures, and Classes are the building blocks of every piece of software written in C++. This programming assignment provides a basic introduction to the creation and use of these important program building blocks.

2.0 Requirements

2.1 (Class) Implement DateType class provided in Section 2.3. Create the specification file (DateType.h) and implementation file (DateType.cpp).

2.2 (Class) Implement User class. Create the specification file (User.h) and implementation file (User.cpp).

2.3 (Struct) Implement AddressType in User.h. AddressType should have: 30-char long streetNamearray;streetNo as int; 30-char long city array; zip as int; and 3-char long state array.

2.4 (Class) User class has the following attributes: 30-char long fnamearray; 30-char long lnamearray; 50-char long email array; gender as a char; 5-char long major, address as AddressType; GPA as float; and dateOfBirth as DateType.

2.5 (Constructor) Create constructors for User class: default constructor User() and User(const char* argfname, const char* arglname, const char* argemail, char argGender, AddressType argAddress, float argGPA, DateType argDateOfBirth). The second constructor should initialize instance variables. Default constructor should assign meaningful initial values to attributes.

2.6 (Observers) Specify and implement observers per instance variable of User class. An observers may return the instance variable or it may take an argument by reference and assign the instance variable to the argument that is passed. Heres the list of functions:

  • void GetFirstName(char afname[]) const;
  • void GetLastName(char alname[]) const;
  • void GetMajor(char amajor[]) const;
  • void GetEmail(char anemail[]) const;
  • void GetGender(char& agender) const;
  • DateType GetDateOfBirth() const;
  • void GetDateOfBirth(DateType& aDateOfBirth) const;
  • float GetGPA() const;
  • void GetGPA(float& aGPA) const;
  • AddressType GetAddress() const;
  • void GetAddress(AddressType& aAddress) const;
  • void GetAddress(char aStreetName[], int& aStreetNo, char aCity[], int& aZip, char aState[]) const;

2.8 (Transformers) Similarly specify and implement transformers that update instance variable.

  • void SetFirstName(const char* afName);
  • void SetLastName(const char* afName);
  • void SetMajor(const char* amajor);
  • void SetEmail(const char* anemail);
  • void SetGender(char aGender);
  • void SetDateOfBirth(DateType aDateOfBirth);
  • void SetGPA(float aGPA);
  • void SetAddress(AddressType aAddress);
  • void SetAddress(char aStreetName[], int aStreetNo, char aCity[], int aZip, char aState[]);

Note: For string assignments use strcpy().

2.9 (Constructor vs Method) Specify and create Initialize method for User class.

  • Initialize(const char* afName, const char* alName, char aGender, AddressType anAddress,float aGPA, DateType aDateOfBirth);

2.10 (Observer for Display) Specify and implement a method for displaying instance variables of User class to the standard output stream. Each attribute should be printed in a single line.

  • void Display () const;

Similarly, create another observer that writes to an output stream file.

  • void Display (std::ofstream& outFile) const;

2.12 (Testing) Create and implement TestDriver class. Create the specification file (TestDriver.h) and implementation file (TestDriver.cpp). This file should have a constructor, int Populate(const char* input,User users[]) method to read user profiles from input file input. The file should be formatted as follows as an example:

FirstName: John

LastName: Rich

Major: CS

Gender: M

Email: jrich@uah.edu

StreetName: Triana

StreetNo: 188

City: Huntsville

Zip: 35806

State: AL

GPA: 3.54

BirthDate: 9 10 1996

----

FirstName: Alice

LastName: Rice

Gender: F

Major: MATH

StreetName: Hughes

Street No: 76

City: Nashville

Zip: 42163

State: TN

GPA: 3.65

Email: alicerice@hotmail.com

BirthDate: 8 15 1998

Note: Read the following file from your project: "C:\tmp\cs221\hw1\hw1samplefile.txt"

Also write your outputs to the same directory. Each output file should start with your username (e.g., raygunTesthw1samplefile.txt).

Add one more function void Test(User users[],int count) const for testing experiments. In order to test the class functions Test() should evaluate all functions in the class. Add another test function that writes results to an output stream file as void Test(std::ofstream& outFile,User users[],int count) const.

NOTE: Test function should start by printing your name and assignment number.

The main() function should create an object of TestDriver and call relevant Test function.

3.0 Commenting Code

Your code should be commented well. Each method should have preconditions and post conditions listed after method declaration in the implementation files.

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

Database Design Query Formulation And Administration Using Oracle And PostgreSQL

Authors: Michael Mannino

8th Edition

1948426951, 978-1948426954

More Books

Students also viewed these Databases questions

Question

How have cultural factors influenced accounting practices in Japan?

Answered: 1 week ago

Question

4. Model self-criticism of your own productions.

Answered: 1 week ago

Question

mple 10. Determine d dx S 0 t dt.

Answered: 1 week ago