How JustAnswer Works:

  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.

Ask Scott Your Own Question

Scott
Scott, MIT Graduate
Category: Homework
Satisfied Customers: 3040
Experience:  MIT Graduate (Math, Programming, Science, and Music)
3546829
Type Your Homework Question Here...
Scott is online now
A new question is answered every 9 seconds

JA: . What is your issue regarding?

Customer Question

hello
JA: Hi. What is your issue regarding?
Customer: i need help with something that has already ebeen posted to your site
JA: Sometimes things that you think will be really complicated end up being easy to fix. The Programmer I'm going to connect you with knows all the tricks and shortcuts. Tell me a bit more about what's going on so he can help you best.
Customer: do i have to pay for the programmers help?
JA: Anything else I can tell the Programmer before I connect you two?
Customer: how much will it cost me
JA: I'm not sure of the exact price, but there's only a $5 deposit. The rest of the price information will be on the page I send you to.
Customer: are you sure this isnt a scame scam
JA: No. I'm the Programmer's Assistant.
JA: I'm sending you to a secure page on JustAnswer so you can place the $5 fully refundable deposit now. While you're filling out that form, I'll tell the Programmer about your situation and connect you two.
Customer: okay
Submitted: 8 months ago.
Category: Homework
Customer: replied 8 months ago.
Description:This assignment is quite simple in what needs to be done 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.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.Open the file and read the contents only counting the number of records in the file.Close file.Dynamically allocate an array to store the data make sure that you only allocate enough storage to hold exactly the number of records needed.Open the file and read the file into the array.Sort the Array on Last Name in ascending order.Print out the information (to standard output) using the example at the end of this document.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).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.Design Considerations:You will use this C/C++ struct to define your data structure.struct Roster {string LName;string FName;char Cheesecake;}struct Roster * MyRoster;You must determine how many records are in the file before you allocate the array to hold the data.You must have the minimum functions to perform the following operations:Get a valid file name that holds the dataRead the data into the array passing the array as a parameterSort the dataFind 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.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.Sorting the Array passing the array as a parameter by reference.Printing the report passing the array as a const value.General Requirements:No global variables, other than constants and type definitions!Use the const qualifier on member functions wherever it is appropriate.Your main routine should just mainly handle the calling of functions and basic program structure.You will need to use the library for output. You may use the library for formatting your output if you wish.When you write source code, it should be readable and well-documented.You must have prototypes for all of your functions.You may use any sorting technique you wish but the simplest (exchange or bubble sort) is all that is required.The size of the array must match exactly the number of records in the file. No more no less.Grading Criteria:The program compiles. If the program does not compile no further grading can be accomplished. Programs that do not compile will receive a zero.(25 Points) The program executes without exception and produces output. The grading of the output cannot be accomplished unless the program executes.(25 Points) The program produces the correct output.(25 Points) The program specifications are followed.(10 Points)The program is documented (commented) properly.(5 Points)Use constants when values are not to be changed(5 Points)Use proper indentation(5 Points)Use good naming standardsSample Input:Please Enter a Valid File Name: MyFile.txt Sample Output:Sample Output:THE CHEESECAKE REPORTLAST NAME FIRST NAME CAKE OR PIE_________ ___________ ___________Alby Matthew PieBarnett Atricia CakeCarnes Donnel PieDumont Atruis CakeEcho Eziel PieFranko Bill CakeGaitros David PieHero Aziko CakeIsrael Anihako PieNumber of Records: 9Number of People Who Believe Cheesecake is Pie: 5Number of People Who Believe Cheesecake is Cake: 4
Customer: replied 8 months ago.
let me know asap if you can help me with this
Customer: replied 8 months ago.
also an estimated time of completion and the amount it will cost me. Thank you so much for your help i appreciate it
Customer: replied 8 months ago.
I have it started
#include
#include
#include
using namespace std;struct Roster
{
string lname;
string fname;
char cheese;
};const int MAXSIZE = 80;
char * givemename(char* fn);
int recordcount(const char * filename);struct Roster* readarray(const int rcount, char *filename);
void readsurvey(const int rcount, const char * filename, struct Roster *);
int countp(const int rcount, struct Roster *MyRoster);
int countc(const int rcount, struct Roster *MyRoster);
void swap(struct Roster *MyRoster1,struct Roster * MyRoster2);
void BubbleSort (const int rcount, struct Roster*MyRoster);
void DrawRecords(const int rcount, struct Roster*MyRoster);
int drawsummary(const int rcount,const int pcount, const int ccount);int main(void)
{
char * filename = new char [MAXSIZE] ;
struct Roster * MyRoster;
struct Roster *PassedRoster;
int rcount=0, pcount=0, ccount=0;
filename=givemename(filename);
rcount = recordcount(filename);
MyRoster = new struct Roster[rcount];
readsurvey(rcount, filename, MyRoster);
pcount = countp(rcount,MyRoster);
ccount = countc(rcount,MyRoster);
BubbleSort (rcount, MyRoster);
DrawRecords(rcount,MyRoster);
drawsummary(rcount,pcount,ccount);
return 0;
}char * givemename(char * fn)
{
ifstream myfile;
cout << "Please enter a file name : ";
cin >> fn;
myfile.open(fn);
while(!myfile.is_open())
{
cout << "Invalid file name. Please re-enter: ";
cin >> fn;
myfile.open(fn);
}
return fn;
}
int recordcount ( const char* filename)
{
int count=0;
char inputline[MAXSIZE];
ifstream myfile;
myfile.open(filename);
do
{
count ++;
myfile.getline(inputline, MAXSIZE);
cout <<inputline<< endl;
}
while(!myfile.eof());
myfile.close();
return count;
}
void readsurvey(const int rcount, const char * fn, struct Roster *mr)
{
ifstream myfile;
myfile.open(fn);
for(int counter=0; counter<rcount ; counter++)
{
myfile >> mr[counter].lname >> mr[counter].fname >> mr[counter].cheese;
}
}
int countp(const int rcount, struct Roster* MyRoster)
{
int count = 0;
for (int i = 0; i<=rcount; i++)
{
if(MyRoster[i].cheese == 'P')
{
count ++ ;
}
}
return count;
}
int countc(const int rcount, struct Roster* MyRoster)
{
int count = 0;
for (int i = 0; i<=rcount; i++)
{
if(MyRoster[i].cheese == 'C')
{
count ++ ;
}
}
return count;
}void swap(struct Roster* MyRoster1,struct Roster* MyRoster2)
{
struct Roster* temp = new struct Roster;
temp = MyRoster1;
MyRoster1 = MyRoster2;
MyRoster2 = temp;
}void BubbleSort (const int rcount,struct Roster*MyRoster)
{
bool swapped=true;
int j = 0;
while (swapped)
{
swapped = false;
j++;
for (int i=0; i<=rcount; i++)
{
if ( MyRoster[i].lname > MyRoster[i+1].lname)
{
swap(&MyRoster[i], &MyRoster[i+1]);
swapped=true;
}
}
}
}void DrawRecords(const int rcount, struct Roster*MyRoster)
{
cout <<" THE CHEESECAKE REPORT " << endl
<<"LAST NAME FIRST NAME CAKE OR PIE " << endl
<<"__________ __________ ___________ "<< endl;for(int i=0; i <= rcount; i++)
{
cout << MyRoster[i].lname << MyRoster[i].fname;
if(MyRoster[i].cheese == 'C')
{ cout << "CAKE";}
else
cout << "PIE";
cout << endl;
}}int drawsummary(const int rcount,const int pcount,const int ccount )
{
cout << "Number of Records: " << rcount << endl << "Number of People"
"Who Believe Cheesecake is Pie: " << pcount << endl << "Number of "
"People Who Believe Cheesecake is Cake: " << ccount << endl;return 0;
}
Customer: replied 8 months ago.
do you need the txt file?
I want to know there is someone working on this and im not getting completely scammed
Customer: replied 8 months ago.
Am i getting charged for this?
Expert:  LogicPro replied 8 months ago.
Hi,WelcomeZip all files; upload the zipped file to http://wikisend.com or http://ge.tt and post download link here. What is the deadline?
Expert:  LogicPro replied 8 months ago.
It seems you didn't get my previous reply.Do you still need this?
Customer: replied 8 months ago.
Yes I need it in two hours.
Customer: replied 8 months ago.
Is it possible that you can help me?
Customer: replied 8 months ago.
I have most of the program done
Expert:  LogicPro replied 8 months ago.
Can it be extended to 3-4 hours
Expert:  LogicPro replied 8 months ago.
Do you still need this?
Customer: replied 8 months ago.
I want my money back
Customer: replied 8 months ago.
Sorry
Customer: replied 8 months ago.
How do I get money back?
Expert:  LogicPro replied 8 months ago.
ok. You never respondedSending the request