//
post:new pleger’s name and their pledge
amount are added to the arrays

//
purpose: when the walker gets a pledge, they use this function to add

//enter the pledger’s name and the
amount per mile to the information

}

void
WalkAThonParticipant::RecordMiles(int milesWalked){

//
pre:none

//
post:the number of miles walked is
recorded

//
purpose: once the Walk-A-Thon is over, this function is used to update

//the object with the number of miles
he/she walked

}

void
WalkAThonParticipant::DisplayCollectionSheet(){

//
pre:none

//
post:a display of all of those who
pledged, how much per mile they pledged

//
and how much they owe is displayed
on the screen

//
purpose: to give the walker the information that they need to go

//around and collect all of the pledges

//

//FORMATTING IS REQUIRED AS FOLLOWS:

//begin by clearing the screen

//put a heading at the top so we know who
the walker is and how many

//miles they walked

//for each pledger, print out

//their name (left-justified in a
column of width 30)

//how much they pledged per
mile(right-justified in a column

//of width 10)

//how much they owe (right-justified
in a column of width 10)

//remember that some of these are
dollar amounts

}

4.You decide to walk in this year’s
Walk-A-Thon that will be held on November 22nd of this year.Define a WalkAThonParticipant object
(using the class in the previous question) for yourself. [Use literals for the
name (like “Mary Smith”) and date (11222002).](4 points)

5.I decide to pledge $5.00 per mile that
you walk.Write a C++ statement, calling
the appropriate member function, to add my pledge to the object that you
defined in the previous question. [Use literals for the name (“Eileen Peluso”)
and the $5.00.](4 points)

6.Imagine that the user is prompted to
enter something at the keyboard.And
suppose that the following definitions have been made:

char str1[40];

int number;

char letter;

The following table contains an input statement in
column 1 and what the user entered in column 2.(Assume that the user hit the enter key after the last character that
you see.)Complete the remaining columns
with what the variable contains, what is still in the buffer (write “empty” if
there’s nothing in the buffer), and how the flags are set (enter T for true or
F for false).(1 points each)

input statement

user entered

variable contains

buffer contains

cin.eof()

cin.fail()

cin >> number;

123

cin >> number;

abc

cin >> number;

123.45

cin >> number;

(ctrl-d)

cin.getline(str1, 40);

Dr. Peluso

cin >> str1;

Dr. Peluso

cin.get(str1, 40);

Dr. Peluso

letter = cin.get();

Dr. Peluso

For questions 7 through 9, assume
that the following code has been written.

struct studentSchedule{

int
socSecNbr;// unique student ID
number

string
name;// name of the student

int
numberOfCourses;// how many courses
they have this semester

string
course[6];// the course codes

};

studentSchedule Oscar = {123456789,
“Oscar”, 4, “CPTR246”, “MATH128”,

“SOC110”,
“HIST128”};

studentSchedule allSchedules[1500];

7.Which of the following statements
displays Oscar’s social security number on the screen? (3 points)

a.cout
<< Oscar << endl;

b.cout
<< Oscar.socSec.Nbr << endl;

c.cout
<< Oscar[socSecNbr] << endl;

d.cout
<< “socSecNbr” << endl;

8.Which of the following for loop
displays the courses that Oscar is taking? (3 points)

a.for
(int i = 0; i < 6; i++)

cout << course[i] << endl;

b.for
(int i = 0; i < numberOfCourses; i++)

cout << studentSchedule.course[i]
<< endl;

c.for
(int i = 0; i < numberOfCourses; i++)

cout << Oscar.course[i] <<
endl;

9.Which of the following refers to the
first course on the schedule of the first student in the array defined above?
(3 points)

a.allSchedules[0].course[0]

b.allSchedules[1].course[1]

c.allSchedules[0].course

d.allSchedules.course[0]

10.Complete the following function that takes a string as input and
returns true if the string contains a valid “product code.”The rules for a valid product code are (1) it
must be exactly 5 characters long and (2) the first 2 characters are letters
and the next 3 are digits. (6 points)