CS 14 - Lab 6
CS 14
Homepage
First Task - Lab Practical
Complete the lab practical as assigned by the TAs (your TA will give you the
URL because there is no link to the practical).
You will have 1 hour and
40 minutes to complete the practical. You will turn in your lab using the electronic
turnin. WATCH THE TIME! The electronic turnin will be gone 1 hour and 40 minutes after
the scheduled start time of your lab section and ASBOLUTELY NO LATE LAB
PRACTICALS WILL BE ACCEPTED NO MATTER WHAT THE REASON EVEN IF YOU ARE ONLY 1 SECOND
LATE. DO NOT TRUST THE CLOCK ON YOUR COMPUTER!!! IT IS NOT THE SAME AS THE
CLOCK ON THE TURNIN SERVER. MAKE SURE YOU OPEN A TURNIN PAGE AND REFRESH IT IF
YOU WOULD LIKE TO KNOW THE CURRENT TIME. REMEMBER THAT LAB PRACTICALS ARE 8%
OF YOUR GRADE. DO NOT PUSH THE TURNIN TIME BECAUSE IF YOU MISS THE TURNIN, YOU
ARE OUT OF LUCK..
You may not use ANY reference material at all and, should I even need
to specify that this includes web, IM, chat, email, book, previous code written
by you,
code written by anyone, etc. You may not look at ANY reference while
doing this lab practical. You may only look at this web page containing the
lab practical, electronic turnin,
and your code that you are currently writing for the practical.
Second Task - Mid-Quarter Evaluations
Please fill out an anonymous review of the course. The
link is available here.
Please make sure you select cs14 in the "select course" drop down box.
We would like you to answer the following questions, so that
we can put on a better course for you:
- Comments for/about the instructor (Ann Gordon-Ross)
- Comments for/about your TA.
Please include your TAs name in your response.
- Comments about the in-lab exercises
- Comments about the programming assignments
- Comments about the quizzes
- Comments about the lecture homeworks
- Comments about the in-class exercises
- Give the first names of 6 people in the course.
- When did you take CS 12 / attempt CS 14 before? If you took CS 12 at another
school, tell us what programming
language and development platform was used, and whether it was
difficult to make the transition.
- What grade are you hoping to earn in this course? (Please be honest, it
is perfectly alright to not expect to get an A in every course which is why
a D- is a passing grade)
When you are done, show your TA the "Thank you page" and you'll be marked
down for 1 point. The evaluation must be completed during lab time.
Third Task - Class Inheritance and Operator Overloading
For this lab you will be working alone. There is a lot to do during this lab
section and if you do not finish during lab time, you may finish outside
of lab. The lab is due 24 hours after your lab section ends. However,
try to finish during your scheduled lab time and demo your program during
lab.
In this lab you will get some programming experience with class inheritance
and operator overloading. You will have 3 seperate classes that together
will define a cylinder and its location. The cylinder is made
up of its height (Cylinder class), area of a 2D splice of the cylinder
(Circle class), and xy point locations (Point class). You will have
to make good judgements on what functions/variables should be
public or private and what kind of inheritance to use. (Remember to use
good encapsulation)
ABSOLUTELY THE MOST IMPORTANT POINT....
It is extremely important that you get this lab working. The next lab
will build upon this lab and I will not be giving you a solution for this
lab. You will need to use the code that you write this week for the
next lab.
--
This means that if you get the code completely done in lab, you
need to make sure both partners have a working copy of the code. If you
do not get the code completed in lab, you must complete it outside of
lab before your next lab session.
-->
The Lab
Write a class called Point. It will contain two data members of type double
to hold the x and y coordinates of the point. It should also contain the
following function members:
- The constructor will take two double parameters that are used to
initialize the x and y cooridinates
- A function called resetValues that takes two parameters and sets the x
and y coordinates
- A function called getX that returns the value of the x coordinate.
- A function called getY that returns the value of the y coordinate.
- Overload the insertion (<<) operator so that it can print out a point
class (the x and y coordinates).
Now write a class called Circle. It will inherit the class Point and have
one double data member for the radius. The following member functions should
also be written.
- The constructor will take three double parameters. One of those will be
the radius of the circle and the other two are used to initialize the
x and y coordinates representing the center of the circle.
- A function called resetRadius that takes one parameter and sets the
radius
- A function called getRadius that returns the radius of the circle.
- A function called getArea that calculates and returns the area of a
circle (PI * r^2). You will use PI = 3.14159265.
- Overload the insertion (<<) operator so that it can print out a circle
class (the x and y coordinates and the radius).
Lastly, write a class called Cylinder. This class will inherit the class
Circle. It will have a data member of type double to hold the height. It
will also contain the following member functions.
- The constructor should take four double parameters. One will represent
the height of the cylinder and the other three will represent the radius,
x, and y coordinates and should be passed on to the circle constructor.
- A function called resetHeight that takes one parameter and sets the
height.
- A function called getHeight that returns the height of the cylinder
- A function called getVolume that calculates and returns the volume of the
cylinder (circleArea * height)
- Overload the insertion (<<) operator so that it can print out a cylinder
class (the x and y coordinates, the radius, and the height).
You will use main.cc to demo your program.
Point Breakdown - In Lab Demo
You may demo your program in lab or it will be
graded from your electronic submission (due 24 hours after the end of your
lab section). Please show the output
from main.cc to the TA if you complete the lab.
Remember, to
receive credit for this lab, you MUST turn the code in online.
If you do not turn in your code online,
you will lose points for your lab. All code must be turned in online for
archival purposes.
Remeber to compile your code using the flags "-g -Wall -W -Werror -pedantic". You
must have a makefile for this lab.
- 2 points - Attendance - Lab attendance will be 20% of the grade for each
lab. You will receive 1 point when the lab begins and 1 point when the lab
ends. Attendance will be taken during the first and last 5 minutes of the
lab period
- 1 point - Completing mid-quarter evaluations (must be done during lab)
- 4.5 points - .375 points for each test case passed for tests 1 to 12
- 1.5 point - operator overloading output. (Must implement operator
overloading correctly to get these points, the TAs will check your code)
- 1 point - Good use of encapsulation i.e. not making everything public
- Deductions:
- -1 point - not logically seperating your code into seperate files
- -1 point - not using protections correctly (i.e. just making everything
public)
- -1 point - not using a makefile
- -5 points - Turned into the wrong lab section.
- -1 point - No name on work turned in
- -5 points - Code not turned in at all. This deduction also applies to
turnins that do not contain a the partners name (only the name that is not
on the turnin will have 5 points deducted. The person that actually turned
the code in will only have 1 point deducted if their name is not on the
turnin).
- -5 points - If your currently assigned partner is in lab and you do not
work together.
- -1 point - If your code seg faults at any time.