Announcements and Reminders
|
||
RecordingUMLUnified Modeling LanguageCIS29 Group Project DocumentationReviewOperator Overloading: Matrix Addition (Example 6-7 from CIS 27 notes)
Create
a class, X, consisting of three data members, a char*, an int, and a
long. These data members are to be used to store a name (both
first and last), an age, and a social security number. Add
any necessary functions to your class. Write an
overloaded insertion operator so that you can print a class
object. The overloaded insertion operator should display the
members as:
Instantiate
a class object using your name, age (you can lie about your age), and
social security number with a constructor that looks like this:
X object(“Joe Bentley”,25,123456789); Use your insertion operator to write the X class object into an output file. Turn in your program code and the output file. main() should have only 4 lines, like this: int main() { X object(“Joe Bentley”,25,123456789); // your name, age, ssn ? ? return 0; } Practice Problems
Create a class called ABC with the
following: a non-static data member: a
char* (you'll be allocating memory dynamically for
this one) A static data member: pi,
initialized to 3.14 Three constructors. A
default ctor, a copy ctor, and another one If necessary, write a destructor. Overload the insertion operator so
that it does something appropriate. Overload the ! operator so that it
prints the static data member. Overload the assignment operator,
so that you can assign one ABC object to another. Write a main() that demonstrates at least one call to every function in the ABC class.
“file.in”
“file.out”
Final format
You should receive an email containing a pdf attachment for the final between 1:40 and 1:45. If you do not receive your email by 1:50, contact the instructor. Use a plain text editor to write your answers for the test Number each problem Watch your time. Your test results must be returned by email at 3:45 pm. Add the test as an attachment. You may use any textbooks, notes, the class web pages, assignments, exercises, your computer and compiler for this test. You may not get any help from anyone during this test. Make sure you use good programming practices for your code. |