1 |
h02 |
CS24 F19 |
Name: | ||||
---|---|---|---|---|
(as it would appear on official course roster) | ||||
Umail address: | @umail.ucsb.edu | section |
||
Optional: name you wish to be called if different from name above. | ||||
Optional: name of "homework buddy" (leaving this blank signifies "I worked alone" |
h02: Chapter 2.3-2.5
ready? | assigned | due | points |
---|---|---|---|
true | Wed 10/02 12:00AM | Wed 10/09 11:59PM |
You may collaborate on this homework with AT MOST one person, an optional "homework buddy".
INSTEAD OF TURNING IN THIS HOMEWORK, YOU WILL TAKE A QUIZ ON GAUCHOSPACE BY THE DUE DATE.
There is NO MAKEUP for missed homework assignments.
The quiz will be made available at least two days before the due date.
Please:
- No Staples.
- No Paperclips.
- No folded down corners.
Complete your reading of Chapter 2, section 2.3 - 2.5 (If you don’t have a copy of the textbook yet, there is one on reserve at the library under “COMP000-STAFF - Permanent Reserve”).
-
1. (30 pts) Consider the point class defined and implemented on pages 64 and 65. Then, answer the following questions:
a. Name all the special class methods that are used to initialize an object of the class at the time that it is created.
b. What is the output of the following code? Assume the code is embedded in a correct C++ program.
point p1, p2(20.0), p3(50,60);
cout<<p1.get_x()<<" "<<p1.get_y()<<endl;
cout<<p2.get_x()<<" "<<p2.get_y()<<endl;
cout<<p3.get_x()<<" "<<p3.get_y()<<endl;
p1 = p3;
p1.rotate90();
cout<<p1.get_x()<<" "<<p1.get_y()<<endl;