Skip to main content
Contents Index
Search Book
Search Results:
No results.
Readability settings Prev Up Next Scratch ActiveCode Profile
title here
\(
\newcommand{\lt}{<}
\newcommand{\gt}{>}
\newcommand{\amp}{&}
\definecolor{fillinmathshade}{gray}{0.9}
\newcommand{\fillinmath}[1]{\mathchoice{\colorbox{fillinmathshade}{$\displaystyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\textstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptscriptstyle\phantom{\,#1\,}$}}}
\)
Exercises 16.16 Exercises
1.
Complete the code by creating a
Point p1 that represents (3, 4.5).
2.
The existing code will make a point
p1 at (4, 3). Shift it so it is at (1, 1).
3.
The existing code will make a point
p1. Make a point
p2 that has x and y value that are 1 more than the values for
p1.
4.
Add a definition for the
getPerimeter function in
Rectangle. Your code will be inside the class.
5.
Add a definition for the
getArea function that is declared in
Rectangle. Your code will be outside the class, so you need to use the scope resolution operator.
6.
Add a definitions for the 2-arg constructor You are defining it outside of the class. Check the comment in the class for how it should behave.
7.
Add a definition for the
scale function so the code passes the test. You are defining it outside of the class. Check the comment in the class for tips on how it should behave.
You have attempted
of
activities on this page.