Transcribed TextTranscribed Text

Assignment learning objectives: Yot are supposed correctly define and write neat code that uses classes, functions, dynamic arrays, constructors, destructors and overloaded operators. The assignment problem: You have just started your new on- campus job at the front desk of the Swinney recreation center. Your job to help students check-out and check-in gym items (towels basket balls, rackets bikes, etc). Traditionally, students who work this job record all items that students check out and manually in two text files (checked out and checked in). At the end of the day. they update third file (students.txt) that includes information about students and what items are currently checked out (if any). However, you believe that this process tedious, time consuming and error prone. Therefore, you are thinking automate this process by writing C++ program that does all the work for you; because you are great programmer who took 201L, and you can do it! See the following figure better understand your program input and output. Log out items Your app Output tembeing assigament files Hint: hit the gym frequently and, that all students check gym all the some students (c.g. towel, locker and basketball) This means are not sure on how much memory for this data Thus, you will write Stadent class that has dynamic array ohold the items that each Student has checked-out Your application will have Student class with the following private data members: string first last name unsigned int the ID number unsigned int for number fitems checked out and the array size string pointer manage the dynamic array The the following public methods: Definition Default allow default values ID. first name last name. The number defaults to and the first and last names Getters ID. first last Getters should object data. Setters ID. first last (if required). The should Setters check that the ID and 10,000. included. Returns the number has currently Checkout eunt() should not change the object's data. Verifies tha adds dynamic array Ifthe item already or for some reason the item Check cannot be added, returns the item was successful, this string& item) function returns If there dynamic array out make the dynamic array ofsize Verifies the out list removes Check In(const string& Ifthis was the last item the out the dynamic array item) should deleted. If the successful. this function returns true, otherwise returns Has( thecked( Out(const Returns list, otherwise string& item) returns false Should not the This ID set to 0, first and Clear() last names and all out data deleted Destructor dynamic memory Operator item) (read data from the text files). It is istream and areference Stream extraction by reading the data in the same stream. Whethe operator items, calls CheckOutf) however you see fit. (write data in text files). Itisa const reference toa stream the following format Stream insertion << . The last . First item. the line output for Student Addition the and returns function this Addition place out for Phelps This method does not return a value. Comparison for Two objects are considered the same have the same ID number, otherwise equality they unequal. and inequality != The main() function: You have three input files: The first file. students. the roster of all students who come the gym. including what items they have checked out (if any). Your program should use a dynamic array Students class to store this data. The second file, ItemsCheckedOUT Lext, lists what several users have checked out It is in the form series of (StudentID. liternID) ordered pairs, with items separated by whitespace. Your program will process this file check out the indicated items correspondingly. The third file. ltemsCheckedIN.txt, has several items that are being checked Search the data array until you find the student who has that item checked out first, and check in using the class method Your application output: Your application should produce new text file, Updated Students txt. which an updated file with all check outs and check ins processed in the same format as the students file. Remember: Make sure ou clearly understand the program and its requirements Always utilize the instructor' office hours Write neat to-follow code and organize it After you finish coding all the requirements this program, think what can gowrong with the code How can others mishandle and how should your program respond to bad input Improve your code accordingly

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

#include "student.h"
#include <iostream>
#include <fstream>

int main() {

    Student *students = NULL;

    ifstream fin;

    // Reading Students.txt file"students.txt");

       cout << "Cannot open Students.txt file!!!" << endl;

    int count = 0;
    while (fin.good()){

       // Reading student information
       Student student;
       fin >> student;

       // if there are not student yet, add it.
       if(students == NULL){
            students = new Student[1];
            students[0] = student;
       } else{    // Or update the dynamic array size
            Student* tmp = students;
            students = new Student[count+1];

            for(int i=0; i < count; i++){
                students[i] = tmp[i];

            students[count] = student;
            delete [] tmp;


By purchasing this solution you'll be able to access the following files:

50% discount

$45.00 $22.50
for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available C-Family Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Upload a file
Continue without uploading

We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats