1.
class Person {
public:
Person(char
lastName[], char firstName[]);
Person
getFather();
getLastName(char
lastName[]);
getFirstName(char
firstName[]);
};
// print out the first and
last name of Lisa Simpson's
grandfather.
2.
class Point {
private:
double x,y;
public:
void setX(double
x);
void setY(double
y);
};
Create an array of the 10
Points (0,0), (1,1), (2,2),
...(9,9)
3.
class Student {
public:
Family
getFamily();
};
class Family {
public:
int getChildCount();
double
getIncome();
};
class LunchProgram {
public:
// write a method
here which determines whether or
// not a child is
eligible. This happens when the
// the family has
an income less than $5000 for each
/ of the children.
4.
class Date {
public:
Date(int month,
int day, int year);
};
class Ticket {
double getPrice();
int buy(char
creditCardNumber[]); // returns true if
//
purchase was successful
};
class AirlineTicketSearch {
public:
AirlineTicketSearch(char departureCity[],char arrivalCity[],
int roundTrip);
setDepartureDate(Date d);
setReturnDate(Date
d);
Ticket
getCheapest();
};
// find the cheapest ticket
from Denver
to Detroit,
// leaving Dec. 23 2004 and
returning Dec. 27 2004.
// If the ticket is less than
$500, try to buy it with
// credit card # 44445555.
Print out an appropriate
// message if the purchase
fails.
5.
class Exam {
public:
double getMax();
double getScore();
};
class Student
public:
getLastName(char
lastName[]);
Exam getExam(int
i); // exam id's begin at 1
};
// declare an array of 10
students
// assume these student
objects are somehow filled with good
data
// print out all the last
name of all students who did
better
// on the second exam than on
the first.