CSCI 261 - Programming Concepts - Fall 2021

AXC - People Validator

→This assignment is due by Wednesday, December 08, 2021, 11:59 PM.←
→ As with all assignments, this must be an individual effort and cannot be pair programmed. Any debugging assistance must follow the course collaboration policy and be cited in the comment header block for the assignment.←
→ Do not forget to complete the following labs with this set: LXC

· Instructions · Rubric · Submission ·


The Purpose


This extra credit homework allows you to earn 20 extra credit homework points. To do so, you must demonstrate a proficiency in classes, file input and output, pointers, and dynamically allocating memory and arrays.


The Person Class


Write a Person class in C++, with separate Person.h and Person.cpp files. Your Person class should have the following private data members:

In addition, your Person class should have the following member functions:

NOTE: you can assume the file you are reading in is correctly formatted.

You may want to consider NotePad or WordPad on your computer to write your code for your Person class. Once you feel good about what you've written, copy the code into your project. Doing this will help you see where you might make mistakes on upcoming exams. (No, pointers and dynamic memory will not be on any exam, but classes will!)


Your main() Requirements:


Before we allocate space for our persons, we need to find out how many we need. First, we'll read through the file, counting how many valid persons there are. Then, we'll iterate through the file again, this time reading the valid persons into a dynamically allocated array.

As usual, we recommend you use the "Incremental Build" software development model. To encourage this use, we break down your main() requirements into steps. We suggest you thoroughly test each step before moving to the next step.

Step 1: How many valid people are in the file?

Step 2: Add valid people to your new people array.

There are exactly 19 invalid people in the data file. At this point you will know by the program output whether you have found them all.

Step 3: Sorting your people array.

We now want to sort your valid people array. We've previously discussed the selectionSort() algorithm (a simple sorting algorithm), and provided brief pseudocode for implementing it. Create these prototypes and function headers so that they operate on your People array, with the end goal of sorting your valid People array by each person's height. For full credit, you should pass a pointer to the array to your selectionSort() function, and use this pointer within the function to access array elements. However, we suggest you first implement the sorting feature using the [ ] notation that you are familiar with, and then (if desired) modify the function to use pointers (not [ ] ). NOTE: getting the function to work with [ ] is worth one point; getting the function to work with * is worth two points.

Step 4: Print a few valid people.

Using your Person's output() function, print the following three valid people:

Do not hard code any offsets or values. Your program should be flexible and based off of the validCount pointer. Your program will be tested against a hidden private †est file to ensure flexibility.

Step 5: Good practice.

There are two things you should do to end the program. First, close your file input stream. Second, free the memory allocated by your program to hold the valid people. Be sure to use the delete[] operation, not delete without [] .


Grading Rubric


Your submission will be graded according to the following rubric.

PointsRequirement Description
2 All labs completed and submitted
LXC
13 Assignment created with dynamic arrays and meets functional requirements above.
1 Public test file generates correct results.
2 Private test file generates correct results.
2 (1) Comments used
(2) Coding style followed
(3) Appropriate variable names, constants, and data types used
(4) Instructions followed
20 Total Points

→This assignment is due by Wednesday, December 08, 2021, 11:59 PM.←
→ As with all assignments, this must be an individual effort and cannot be pair programmed. Any debugging assistance must follow the course collaboration policy and be cited in the comment header block for the assignment.←
→ Do not forget to complete the following labs with this set: LXC


Submission


Always, always, ALWAYS update the header comments at the top of your main.cpp file. And if you ever get stuck, remember that there is LOTS of help available.

It is critical that you follow these steps when submitting homework. You can view these steps by watching the Windows / Mac video.

If you do not follow these instructions, your assignment will receive a major deduction. Why all the fuss? Because we have several hundred of these assignments to grade, and we use computer tools to automate as much of the process as possible. If you deviate from these instructions, our grading tools will not work.


Submission Instructions



Here are step-by-step instructions for submitting your homework properly:

  1. Make sure you have the appropriate comment header block at the top of every source code file for this set. The header block should include the following information at a minimum.
    /* CSCI 261: Assignment XC: AXC - People Validator
     *  * Author: XXXX (INSERT_NAME) * Skip Days Used: #
    * Skip Days Remaining: #
    * Resources used (Office Hours, Tutoring, Other Students, etc & in what capacity):  * // list here any outside assistance you used/received while following the * // CS@Mines Collaboration Policy and the Mines Academic Code of Honor *  * XXXXXXXX (MORE_COMPLETE_DESCRIPTION_HERE)  */
    Be sure to fill in the appropriate information, including:
    • Assignment number
    • Assignment title
    • Your name
    • How many skip days you are applying to this assignment (if you are applying none, still enter zero)
    • The number of skip days you have left for the remainder of the semester (keep track of how many you have used across all assignments)
    • If you received any type of assistance (office hours - whose, tutoring - when), then list where/what/who gave you the assistance and describe the assistance received
    • A description of the assignment task and what the code in this file accomplishes.
  2. File and folder names are extremely important in this process. Please double-check carefully, to ensure things are named correctly.
    1. The top-level folder of your project must be named SetXC
    2. Inside SetXC, create 2 sub-folders that are required for this Set. The name of each sub-folder is defined in that Set (e.g. LXC, and AXC).
    3. Copy your files into the subdirectories ofSetXC (steps 2-3), zip this SetXC folder (steps 4-5), and then submit the zipped file (steps 6-11) to Canvas.
    4. For example, when you zip/submit SetXC, there will be 2 sub-folders called LXC, and AXC inside the SetXC folder, and each of these sub-folders will have the associated files.

  3. Using Windows Explorer (not to be confused with Internet Explorer), find the file named "main.cpp" located inside the folder for the particular lab or homework assignment you will submit.

    STOP: Are you really sure you are viewing the correct assignment's folder?

  4. Now, for AXC, right click on the main.cpp to copy the file. Then, return to the SetXC/AXCfolder and right click to paste the file. In other words, put a copy of your homework's main.cpp source code into the SetXC/AXC folder. Repeat this for each additional header & source file you have with this assignment, plus CMakeLists.txt.

    Follow the same steps for LXC, to put a copy of your lab's main.cpp into the SetXC/LXC folder.

    STOP: Are you sure your SetXC folder now has all your code to submit?

  5. Now, right-click on the "SetXC" folder.
    1. In the pop-up menu that opens, move the mouse "Send to..." and expand the sub-menu.
    2. In the sub-menu that opens, select "Compressed (zipped) folder".

    STOP: Are you really sure you are zipping a SetXC folder with sub-folders that each contain a main.cpp file in it?

  6. After the previous step, you should now see a "SetXC.zip" file.

  7. Now visit the Canvas page for this course and click the "Assignments" button in the sidebar.

  8. Find SetXC, click on it, find the "Submit Assignment" area, and then click the "Choose File" button.

  9. Find the "SetXC.zip" file created earlier and click the "Open" button.

    STOP: Are you really sure you are selecting the right homework assignment? Are you double-sure?

  10. WAIT! There's one more super-important step. Click on the blue "Submit Assignment" button to submit your homework.

  11. No, really, make sure you click the "Submit Assignment" button to actually submit your homework. Clicking the "Choose File" button in the previous step kind of makes it feel like you're done, but you must click the Submit button as well! And you must allow the file time to upload before you turn off your computer!

  12. Canvas should say "Submitted!". Click "Submission Details" and you can download the zip file you just submitted. In other words, verify you submitted what you think you submitted!

In summary, you must zip the "SetXC" folder and only the "SetXC" folder, this zip folder must have several sub-folders, you must name all these folders correctly, you must submit the correct zip file for this homework, and you must click the "Submit Assignment" button. Not doing these steps is like bringing your homework to class but forgetting to hand it in. No concessions will be made for incorrectly submitted work. If you incorrectly submit your homework, we will not be able to give you full credit. And that makes us unhappy.


→This assignment is due by Wednesday, December 08, 2021, 11:59 PM.←
→ As with all assignments, this must be an individual effort and cannot be pair programmed. Any debugging assistance must follow the course collaboration policy and be cited in the comment header block for the assignment.←
→ Do not forget to complete the following labs with this set: Warning: count(): Parameter must be an array or an object that implements Countable in /Users/jpaone/Courses/261_Programming Concepts/Websites/Fall2021_php/makeHWPage.php on line 20 ←