CheeseCake
This assignment is quite simple but could turn out to be one of the more complicated programming projects that you will have this term. This assignment will involve storing information in a dynamically allocated array, sorting information and then looking at the data and analyzing the data in the form of a summary. You are to read in a file that contain several records of data, each record will contain: The Last Name of the person taking the survey, First Name of the person taking the survey, and a character “C” or Character “P” that indicates whether a person believes that Cheese cake is a cake “C” or is really a pie “P” . There are an unknown number of records. Programming Specifications: Here are the lists of tasks and specifications.
1. Ask the user for the name of the input file. You must make sure it is a valid file and that it can be opened. If not, you need to continually ask the user for a valid file.
2. Open the file and read the contents only counting the number of records in the file.
3. Close file.
4. Dynamically allocate an array to store the data make sure that you only allocate enough storage to hold exactly the number of records needed.
5. Open the file and read the file into the array.
6. Sort the Array on Last Name in ascending order.
7. Print out the information (to standard output) using the example at the end of this document.
8. Print out at the end of the summary of information (i.e. how many people said that Cheesecake is a Cake and how many said it was a Pie).
9. Also print out the number of participants.
Be sure that the number of people who said Cheesecake is a Cake + Cheesecake is Pie is equal to the total number participants. COP3010 Programming I in C/C++ COP3014 Page 2 Design
Considerations:
1. You will use this C/C++ struct to define your data structure. struct Roster { string LName; string FName; char Cheesecake; } struct Roster * MyRoster;
2. You must determine how many records are in the file before you allocate the array to hold the data.
3. You must have the minimum functions to perform the following operations: o Get a valid file name that holds the data o Read the data into the array passing the array as a parameter o Sort the data o Find the number of people who said Cheesecake is a Pie passing the array as a parameter and returning the number as a return value of the function. o Find the number of people who said Cheesecake is a Cake passing the array as a parameter and returning the number as a return value of the function. o Sorting the Array passing the array as a parameter by reference. o Printing the report passing the array as a const value.
General Requirements:
1. No global variables, other than constants and type definitions! 2. Use the const qualifier on member functions wherever it is appropriate. 3. Your main routine should just mainly handle the calling of functions and basic program structure. 4. You will need to use the library for output. You may use the library for formatting your output if you wish. 5. When you write source code, it should be readable and well-documented. 6. You must have prototypes for all of your functions. 7. You may use any sorting technique you wish but the simplest (exchange or bubble sort) is all that is required. 8. The size of the array must match exactly the number of records in the file. No more no less.
cheesecake.dat
Charlesworth Aimee C
Prre Aleesha C
Raines Alison C
Griffin Amanda C
John Amanda C
Mitchell Amanda C
Kapec Andrew C
Moses Andrew C
Veldkamp Anise C
Popiel Anthony C
Kellem Ashley C
Johansen Austin C
Bassett Blair C
Tenenbaum Bradlee C
Rochet Brian C
Macke Bridget C
Jones Brittany C
Troop Brooke C
Wilson Caitlin C
Dulgar Caleb C
Fernandez Carlos C
Hughes Caroline C
Langston Catherine C
Griggs Charles C
Brunk Chelsea C
Mortimer Chelsea C
Ince-Ingram Chloe C
Love Chloe C
Burmeister Christophe C
White Corey C
Safra Cory C
Rolle Courtney C
Paul Daphnee C
Taylor David C
Johnson Elizabeth C
Major Elizabeth C
Stein Elizabeth C
Hutchinson Emily C
Richeson Emily C
Todoroff Eric C
Hosch Erica C
Martin Erika C
Marte Gabriel C
Sjodin Garry C
Voss Hayley C
Silva Heather C
Tully Hillary C
Sonin Jaclyn C
Palad Jager C
Kelly Jason C
Allen Jazmine C
Guess Jazmine C
Voss David P
Lantz Jeffrey C
Carr Jennifer C
Oliver Jessica C
Smith Jessica C
Mazzoni John C
Dasilva Jose C
Rhodes Joseph C
Rayner Joshua C
Gibson Kaileigh C
Lankenau Kaley C
Zelman Katherine C
Garnett Kathleen C
Worthington Kelly C
Debowes Keri C
Wheeler Kevin C
Stenson Kheva C
O'Hara Kimberly C
Shelton Kiyah C
Olfson Kristina C
Biro Krystina C
Berrien Lakia C
Hamilton Lauren C
Perez Leandro C
Cortelli Leonard C
Mesa Lina C
Abramo Lindsey C
Lefton Lindsey C
Morrison Lindsey C
Voss Zach C
Siegel Lindsey C
Robinson Malik C
Harkins Mallory C
Neiman Marc C
Summerford Margaret C
Marshall Mariah C
Johnson Marshall C
Majeed Mary C
Yanossy Matthew C
Bean Meagan C
Cain Meagen C
Carvajal Megan C
Khan-Karen Megan C
Moore Megan C
Mcduff Meghan C
Mayer Meredith C
Rainey Michael C
Genter Michaelene C
Pyle Molly C
Shepard Morgan C
Wicks Morgan C
Belafquih Myriam C
Jenkins Nicholas C
Nagatani Nora C
Tribue Paris C
Carlisle Patrick C
Mcgrew Phillip C
Kafka Prce C
Gray Rachael C
Burke Rachel C
Conway Rachel C
Makeeff Rachel C
Gonzalez Rafael C
Jackson Raymond C
Rudolph Rebecca C
Harbour Robert C
Nightingale Robert C
Richardson Robert C
Muller Sarah C
Anthony Savannah C
Han SeRi C
Servius Servenot C
Simon Shanae C
Smith Sheena C
Holland Sophie C
Wills Spencer C
Teperino Stefano C
Hunt Stephanie C
Gotlieb Susan C
Labossiere Tarica C
Coram Taylor C
Sweet Terenycia C
Barcomb Thomas C
Clifton Thomas C
Mcgurk Timothy C
Williams Torry C
Brown Trae C
Cantey Travis C
Hetzel Travis C
Cobb Vernon C
Moody Wesley C
Brandon William C
Walker William C
Mcadoo Winston C
Le Yen C
Taylor Zachary C
Barnes Abigail P
Peters Adrian P
Bayliss Adrianna P
Valleau Alyssa P
Furka Amanda P
Chandhok Amanvir P
Kuc Amra P
Colbert Amy P
Cole Andrew P
Kramer Andrew P
Vassil Andrew P
Myers Arielle P
Hargrove Ashley P
Farris Brittany P
Waesche Brittany P
Yarema Carah P
Zappia Catherine P
Byrnes Chelsey P
Swingle Cody P
Herring Craig P
Kaufmann Elizabeth P
Swire Emily P
Fuhrmann Erika P
Walsh Erin P
Revolinski Forrest P
Vickers George P
Reinhardt Gregory P
Reagin Haley P
Perez Ivan P
Hager Jackson P
Herndon Jaimie P
Laberdesque Jared P
Chaaban Jena P
So Jennifer P
Orr John P
Brooks Jonathan P
Truong Jonathan P
Rochester Jordan P
Fox Joy P
Latchford Kaitlyn P
Guice Katelin P
Sinn Kathryn P
Savage Kayla P
Wright Kristine P
Simons Kyle P
Palmer Latreas P
Cohen Lauren P
Diaz-Cortes Marcelo P
Lewis Mario P
West Matthew P
Mayo Monica P
Casimiro Paulo P
Lea Rachael P
Cammuse Rachel P
White Rachel P
Nichols Rachelle P
Guthrie Ryan P
Partridge Samuel
10 years ago
Purchase the answer to view it
- cheesecake_v1_answer.zip