Ask C/C++ Expert


Home >> C/C++

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.

Attachment:- CheeseCake.txt

C/C++, Programming

  • Category:- C/C++
  • Reference No.:- M91752913
  • Price:- $45

Priced at Now at $45, Verified Solution

Have any Question?


Related Questions in C/C++

Question 1find the minimum and maximum of a list of numbers

Question: 1. Find the Minimum and Maximum of a List of Numbers: 10 points File: find_min_max.cpp Write a program that reads some number of integers from the user and finds the minimum and maximum numbers in this list. Th ...

Software development fundamentals assignment 1 -details amp

Software Development Fundamentals Assignment 1 - Details & Problems - In this assignment, you are required to answer the short questions, identify error in the code, give output of the code and develop three C# Console P ...

What are the legal requirements with which websites must

What are the legal requirements with which websites must comply in order to meet the needs of persons with disabilities? Why is maximizing accessibility important to everyone?

There are several ways to calculate the pulse width of a

There are several ways to calculate the pulse width of a digital input signal. One method is to directly read the input pin and another method (more efficient) is to use a timer and pin change interrupt. Function startTi ...

Assignment word matchingwhats a six-letter word that has an

Assignment: Word Matching What's a six-letter word that has an e as its first, third, and fifth letter? Can you find an anagram of pine grave. Or how about a word that starts and ends with ant (other than ant itself, of ...

1 implement the binary search tree bst in c using the node

1. Implement the Binary Search Tree (BST) in C++, using the Node class template provided below. Please read the provided helper methods in class BST, especially for deleteValue(), make sure you get a fully understanding ...

Assign ment - genetic algorithmin this assignment you will

ASSIGN MENT - GENETIC ALGORITHM In this assignment, you will use your C programming skills to build a simple Genetic Algorithm. DESCRIPTION OF THE PROGRAM - CORE REQUIREMENTS - REQ1: Command-line arguments The user of yo ...

Project - space race part a console Project - Space Race Part A: Console Implementation

Project - Space Race Part A: Console Implementation INTRODUCTION This assignment aims to give you a real problem-solving experience, similar to what you might encounter in the workplace. You have been hired to complete a ...

Why do researcher drop the ewaste and where does it end

Why do researcher drop the ewaste and where does it end up?

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As