Due Mon 9/09: Quiz Friday: Development
cycle, Readings in Deitel & Deitel
1. In Chapter
1 of Deitel & Deitel's C++: How to Program, read Sections
1.2-1.4 and 1.6, and pp. 42-43 of Summary
2. Print out Development Cycle template and
fill it in without referring to your notes.
Due Tues 9/10:
0. CD people: my CD handout won't install
Dev-C++ but will give you needed C++ files. Sorry... Try downloading
setup.zip into the Dev-C++ directory you copied
from the CD and then follow the installation
instructions. (sort of) I'll try to iron this out ASAP
1. In Chapter
1 of Deitel & Deitel, read Sections 1.5, 1.7-1.8,
1.10 and 1.13
2. On p. 50, do Self-Review Exercises 1.1 and 1.2
Due Weds 9/11:
1. In Chapter
1 of Deitel & Deitel, read Sections 1.11 and 1.14
and skim thru section 1.12 to get a vague notion of objects
Due Thurs 9/12: Quiz Fri
Handwritten (by hand, not printer): Letting pi = 3.14, write these complete
programs in C++:
1. Given circumference, find radius of a circle
2. Given area, find circumference of a circle
Using the test data below, validate the correctness of your program by
role-playing the CPU and its manipulation of the values stored in memory
(RAM).
Test data: r
C A
1 6.28 3.14
1.5 9.42 7.065
2 12.56 12.560
Due Fri 9/13:
Handwritten (by hand, not printer):
Write complete C++ program that prompts the user for the lengths of
a leg and the hypotenuse of a right triangle and calculates the length of
the other leg on that basis. Test data: (5, 12,
13), (5, 12, 13), (1,5, 2,
2.5). Try (-5, 12, 13)!!
Due Tues 9/17:
0. Dev-C++ CD installation people:
a. If you tried to install form CD I distributed last week,
delete those folders before proceeding.
b. Copy mpx3 folder from CD to your hard disk
c. Follow the instructions at
Dev-C++
installation page
1. In Chapter
1 of Deitel & Deitel, read Sections 1.19
and 1.20. Ignore the
expression std::cout, which is needed to refer to cout when iostream
rather than iostream.h is
#included.
2. Programming:
A. Using the sqrt function, write short program that
behaves like this:
Finding absolute value of x
Enter x: -5
|-5| = 5
B. Write program that behaves like this:
Solving system of equations: ax + by = c
dx + ey = f
Enter a, b, c (spaces between numbers): 3 4
-1
Enter d, e, f (spaces between numbers): 2 5
4
(x, y) = (-3, 2)
More test data:
1. x + 2y = 3 and 4x + 5y = 6: (x, y) = (-1, 2)
2. 1.5x - 5y = 8 and -6x + 20y = 15: What happens when you run
program? Why?
Due Weds 9/18:
1. In Chapter
1 of Deitel & Deitel, read Sections 1.21
and 1.22 (pp.
25-34).
2. Modify program due Fri 9/13 by making all the float
variables ints. Using the given test data (1,5, 2,
2.5 ), predict what will
happen. Then compile & run the program to verify your conjecture.
Due Thurs
9/19:
0. Review for half-period quiz Fri.
1. Reading: Hubbard's Programming with C++, read sections
2.1, 2.5 (noting that we're only responsible for the int type),
2.9-2.10 and 2.12
2. Programming: Hubbard problem 2.2 on p. 33. Hardcopy may be
submitted instead of handwritten.
Due Fri 9/20:
0. Review for half-period quiz Fri. Also see
Absence on day of
scheduled exam
1. Programming: The minimum number of coins problem. Hint:
this is a perfect occasion for the mod operator, %. But keep this in
mind: a % b is a syntax error if either operand is NOT an int.
Here's sample output:
Finding minimum number of total coins in quarters, dimes, nickels, and
pennies
Enter dollar amount: 1.97
7 quarters = 1.75
2 dimes = 0.20
0 nickels = 0.0
2 pennies = 0.02
------------------------
Total = 1.97
Total coins: 11
2. Solution to 2 by 2 linear system program due Tues 9/17:
..
cin >> d >> e >> f;
x = (c*e - b*f)/(a*e - b*d);
y = (c*d - a*f)/(b*d - a*e);
// Don't use x to solve for y. This prevents rounding error in computation of x
to be
// introduced in the computation of y!!!
Due Mon 9/23:
1. Reading: Hubbard sects 2.13 (E-Format) and 3.1 (The if
statement), and 3.3 (Keywords)
For equivalent material in Deitel & Deitel read Chapter
2, sects 2.4 and 2.5
2. Programming: Bring in hardcopy OR handwritten
version of solution to minimum number of coins problem
due Fri 9/20.
3. Programming: Bring in hardcopy OR handwritten
version of quadratic equation solution program discussed Thurs & Fri.
Groups will submit programs from every member, designating two to be the
basis of the group grade.
a. Program cannot include C++ features not
reviewed in class.
b. Therefore, program should only attempt to solve and print real
roots.
4. Programming: Each group is expected to develop test data for the
program and to submit it on Monday.
a. Be sure that every equation submitted is
accompanied by its solution.
b. Look ahead: since you know that you'll eventually be
programming the computer to state the number and nature of the roots and to
print out imaginary roots, include equations (and solutions) which will
enable you to validate the correctness with which these tasks are eventually
implemented.
Due Tues 9/24:
1. Reading: Hubbard sects 3.2 (if/else), 3.4 (relational
operators), 3.5 statement blocks
For equivalent material in Deitel & Deitel read Chapter
2, sect 2.6
2. Programming:
1. Modify quadratic formula program hardcopy or
handwritten): Although it won't be able to
prevent these two execution errors:
#1. dividing by
0
#2. calling sqrt
with a negative argument
if should at least be able to announce them
before they occur. (Don't use else feature).
Run your solution program to validate it. If
you don't see the error message, change the
statements that print the messages by
substituting cerr for cout. EXAMPLE: change
..
cout << "ERROR:
quadratic coefficient can't be zero" << endl; to
..
cerr << "ERROR:
quadratic coefficient can't be zero" << endl;
2. Complete this fragment (handwritten):
int n;
cout << "Enter positive number:
";
cin >> n;
if (??????????)
cout << n <<
" is a perfect square." << endl;
if (?????????)
cout << n <<
" is not a perfect square." << endl;
Due Weds 9/25: Quiz Friday
1. Reading: Hubbard sects 2.8 (composite assignment) 2.14
(scope), 3.10 (else/if)
For equivalent material in Deitel & Deitel read Chapter
2, sect 2.6 (focus on new material)
2.11 (composite assignment), & 2.12 (increment &
decrement operators)
2. Programming: Download qf1.cpp,
or qf1.cpp (alternate site), paste into your C++
system's editor, and complete program as specified therein
Due Thurs 9/26: Quiz Friday
1. Optional: (see Fri)
2. Programming: Complete numeric to letter
grade conversion program as specified in class.
a. Use else if feature rather than nesting (which we
haven't examined yet).
b. Do _NOT_ use compound inequalities (which we haven't
examined yet)..
c. Recommended: Use the curly braces {} for statement
blocks, even for single statements.
3. Reading: Hubbard sects 3.6 (compound conditions), 3.7
(short-circuiting),
3.8 (boolean expressions) For equivalent material in Deitel & Deitel read Chapter
2, sect
2.6 (focus on new material)
Due Fri 9/27: Quiz Friday (8 pts on development cycle)
0. Report to room
635 instead
of 404
or 429 and...
LEAVE EARLIER THAN
USUAL TO AVOID TRANSPORTATION DELAYS CAUSED BY RAIN
1. Optional: 1. Go to Deitel & Deitel
log
on page and register as a new user
2. Log on, go to bottom of page, and select Chapter 2
3. Under Tips, select Good Programming
Practices & review 2.1 thru 2.9 and 2.11
thru 2.14
4. Under Reference Material, select ASCII
character set to examine codes for
char values (do NOT memorize!)
2. Programming: Classify triangle by angle
given lengths of 3 sides.
a. Given a, b, c, assume 1. no length is larger than
c
2. lengths a, b, and c form a triangle
b. Use compound conditions and Pythagoras
c. Test data: (5, 11, 12) is acute, (5, 12, 14) is
obtuse, (9, 40, 41) is right
d. and...LEAVE EARLIER THAN USUAL TO AVOID TRANSPORTATION
DELAYS CAUSED BY RAIN
Due Mon 9/30:
Please email me if you haven't received Hubbard by Saturday
9/28. State who you are since your email address or screen name may not
make that very obvious.
0. Optional: 1. Go to Deitel & Deitel
log
on page and register as a new user
2. Log on, go to bottom of page, and select Chapter 2
3. Under Tips, select Good Programming
Practices & review 2.1 thru 2.9 and 2.11
thru 2.14
4. Under Reference Material, select ASCII
character set to examine codes for
char values (do NOT memorize!)
1. Programming [handwritten or hardcopy]: Classify
triangle by angle given lengths of 3
sides. (See 9/27)
a. In this version, do NOT assume that c represents
the longest side!!
b. Do NOT sort the values in a, b, c: The challenge is to
work with data that is not
necessarily sorted.
c. Look for ways to CONTROL REDUNDANCY
d. After you validate, try to implement this decision
structure:
if (triangle
is acute) ....
else if (triangle
is obtuse)...
else // triangle is
right
But don't test for acuteness first until
you get program working correctly by
using else to announce the acute
case.
2. Reading: Hubbard sect. 3.9 (Nested decisions) and 3.7
(short-circuiting,
which was recently assigned but not necessarily read)
3. Debugging:
1. Enter this statement somewhere in program that has
successfully compiled recently:
cout
>> "Hello world\n"; // ERROR: operator >>
used but operator << is required
Compile to see the message with which your
compiler responds.
2. Enter this statement somewhere in program that has
successfully compiled recently:
cout
<< "Hello world\"; // ERROR: "world\"
should be "world\n"
How do you think your compiler will
respond to the missing 'n'? Make an
educated guess before compiling to test your
conjecture.
Due Tues 10/01: Exam Friday.
1. Programming [handwritten or hardcopy]: Modify program due
Monday:
a. Test whether lengths a, b, and c form a triangle
b1. If they do:
1. Classify by SIDE: scalene,
isosceles, equilateral
2. Classify by ANGLE: acute, obtuse,
right
b2. Else announce that lengths don't form a triangle
Do NOT use triangle inequality test more than once. (This will
require
you to use nesting, which
is
appropriate for this problem)
2. Debugging: Remove
a closing brace, }, from your if block and compile to see
the resulting error message.
Due Weds 10/02: Exam Friday.
1. Programming [handwritten or hardcopy]:
a. Save the triangle classification program due Tues to a new
file.
b. Modify the program by sorting a, b, c, in ascending
order (end result:
a <= b <= c).
c. Use the fact that a, b, c are sorted to simplify classification
by angle
d. Use the fact that a, b, c are sorted to simplify classification
by side
Due Thurs 10/03: Exam Friday.
1. Reading: Sect 4.1 (The while statement), p. 62, up to but
not
including Fibonacci numbers example (the break
statement)
2. Programming concepts [handwritten answers]:
a. Download or print danglingTxt.txt and
answer the questions as
specified.
b. Review Questions (p.49): 3.2. 3.3, 3.8 thru
3.11
Due Fri 10/04: Exam Friday. See
Absence on day of
scheduled exam
1. Programming [handwritten or hardcopy]: Download charCodes.cpp
(find it on
SHS MCX1 menu and click on it) and complete Parts
1 and 2. Run program to
validate your solutions.
2. Debugging: What's wrong with this fragment?
int n(1);
while (n != 10 ) {
cout << n << endl;
n += 2;
}
Due Mon 10/07: Exam Friday.
1. Reading:
a. Sect 9.1 (Intro to C++ strings), sect 9.4 (the standard
C++ string
type). Focus on these member functions:
length(), substr(), and find().
b. Then download string1.cpp
(click on it), compile and run the program. On
the basis of your reading, this example
program's output should make sense!
Note
to Visual C++ users:
1. If you install the AP classes successfully, change each
occurrence
in the program of the keyword string
to apstring, change #include
apstring.h to string, and
instruct compiler to compile apstring.cpp
in addition to string1.cpp
2. Otherwise, to get your C++ strings accepted by compiler,
try appending
each reference to a string object to
the expression string::
EXAMPLE: string x, y;
string::x = "MY PROGRAM";
cout << string::x << endl;
2. Programming [handwritten or hardcopy]:
Download string2.cpp
and complete as specified
Due Tues 10/08: (This assignment has been revised) Exam Friday.
1. Programming [handwritten or hardcopy]: Download string2B.cpp
and
complete as specified.
2. Reading: Review these
pages in Hubbard and write them down on overleaf
to facilitate referring to them in the future:
a. ASCII codes, p. 342-345
b. Standard C++ Operators (listed in order of
precedence). pp. 351-352
c. Math functions (declared in math.h) p. 89
d. Important C++ functions and their specifications:
p. 396-400
3. Reading: In Litvin's Be Prepared
for the APCS Exam, read section
2.5 (apstring
class). Don't worry if you don't understand everything
there--just look at
examples of how substr(), find(), and length() member
functions are used.
Due Weds 10/09: Exam Friday.
0. Setups: You should be setting up your
compiler's environment for the AP classes, especially
the apstring class, which is a subset of the C++
string class. See Skylight Publishing's
How
to use the AP Classes with your compiler. This includes instructions
for Visual C++,
Borland C++, and Turbo
C++.
a. There's a download for setting up Visual C++
for the AP classes at Knowlton
Associates site
1. Programming [handwritten or hardcopy]: Download
string3.cpp
and
complete as specified. Do the best you can with problem 2 in
light of
the fact that we haven't reviewed the + (concatenation)
operator and its
use in string operations.
2. Debugging [handwritten answers
on hardcopy]: Download stringDebug.cpp
print and examine code, and answer question1. Then compile
code and answer
question 3.
Due Thurs 10/10: Exam Friday.
1. Programming [handwritten or hardcopy]:
a. Download
gcd.cpp
and complete as specified. You will need to define
additional variables. TEST DATA has
been provided.
b.
Now that you're acquainted with the concatenation operator, complete
problem 2
in string3.cpp
(originally due Weds)
2. Reading & Answering AP exam questions: Litvin's Practice Exam
A-1 (starts
on p. 129), do problems 1-2.
Due Fri 10/11:
1. Reading: Read Hubbard section 4.4
(The for loop)
2. Programming [handwritten or hardcopy]: Download stringConcat.cpp
and complete
problems 1-2 as specified. Problem 3 is a challenge problem
requiring a little
bit of thinking beyond what we've examined in class. (Old
wine in new bottles).
Due Tues 10/15:
1. Reading: Read Hubbard section
4.3
(The do/while loop)
2. Programming [handwritten or hardcopy]:
1.
Factorial program with flowchart
a. Write flowchart for finding n! as
started and discussed in class.
b. Download fact1.cpp
(at my web site) and complete as
specified.
2.
Complete problems 1-2 in stringConcat.cpp
(at my site) which was due Fri
3. Download prime.cpp and complete as
specified
Due Weds 10/16:
1. Reading:
1. Read Hubbard
Example 4.18 (multiplication table) pp. 69-70
2. See primesS.cpp
for standard solution to prime.cpp using a boolean flag.
2. Programming [handwritten or hardcopy]:
1. Download triple1.cpp and
complete as specified
2.
Use nested for loops to complete problem 3 in stringConcat.cpp
Due Thurs 10/17: Exam Friday. See
Absence on day of
scheduled exam
1. Reading:
1. See primesS.cpp
for standard solution to prime.cpp using a boolean flag.
2. Programming [handwritten or hardcopy]:
1. Download triples2.cpp and
complete as specified. Note that your objective
is to use the generating numbers m
and n to print out Pythagorean triples:
(m, n) =
(2, 1), (3, 1), (3, 2), (4, 1), (4, 2), (4, 3), (5, 1), (5, 2)
etc...
Due Fri 10/18: Exam Friday. See
Absence on day of
scheduled exam
1. Reading: Hubbard sect
5.3 (User-defined functions). Just read page 90.
2. Programming [handwritten or hardcopy]: Download gcdFunction.cpp
and
complete as specified.
Due Mon 10/21: Quiz Thurs or Fri
1. Reading: Hubbard sect
5.4 (test "drivers"), sect 5.6 ("local" variables)
2. Programming [handwritten or hardcopy]:
1. Download and complete as specified: toUpperF.cpp,
primes1.cpp,
and...
2. Read Hubbard sect 5.7 (void functions) and don't
worry about the switch
statement in the example. Then download
& complete pyramid.cpp.
NOTE: void functions do NOT need return
statements and can only return control,
not a value.
Due Tues 10/22: Quiz Thurs or Fri
0. For Visual C++: see
Setting
up C++ string & apstring
1. Reading: Hubbard sect
3.5 (statement blocks), sect 5.13 (scope of an object);
Litvin pp. 29-30
2. Programming [handwritten or hardcopy]: Download perfectF.cpp
1. Complete as isPerfect() as specified.
2. Look at listAmicable() (Not
due until Weds). Remember that p and q are
amicable
if the sum of p's proper divisors is q and the sum of q's
proper divisors is p.
3. Due in near future: how to modify triples2.cpp
to print primitive triples
exclusively? How might a function help?
Due Weds 10/23: Quiz Thurs or Fri
A. AP Comp Sci tutoring: room 404, 3:30-5:00 this Weds
0. Debugging: Download
linkError.cpp,
compile and try to link. Make a mental note of how your system
responds to a linking error and what a linking
error error message actually looks like.
1. Reading: Hubbard
sect 5.5 (function declarations & prototypes)
2. Programming [handwritten or hardcopy]:
1. Download nested.cpp
and complete as specified.
2. In perfectF.cpp,
complete as listAmicable() as specified.
Due Thurs 10/24: Quiz Thurs or Fri
1. Programming [handwritten or hardcopy]:
1. Save triples2.cpp to triples3.cpp and modify the
program in a manner such
that it only prints primitive triples. An if
statement will be necessary and
a helper function would be...helpful!!
2. Update both functions in perfectF.cpp by creating a
helper function, sigma(),
that returns the sum of its proper divisors.
3. Modify nested.cpp in a manner that produces the following
output:
triangle1():
4
triangle2(): 4 3 2 1
3
4
4 3 2
2 3
4
4 3
1 2 3
4
4
Due Mon 10/28: Test Fri
1. Reading: Hubbard
sect 5.10 (Passing by reference)
2. Litvin Exam A-1 (p. 129) #3-4, 8
3. Programming [handwritten or hardcopy]:
1. Download convertF.cpp
and complete as specified.
2. Download eff-ifBlk.cpp
and run with modem off (or times won't be accurate).
3. Hubbard p. 113, problem 5.21 (Triangular numbers)
Due Tues 10/29: Test Fri
1. Reading: Hubbard
sect 5.11 (Passing by constant reference)
2. Convert to octal (base 8): 501; Convert to base 10: octal 357
2. Programming [handwritten or hardcopy]:
1. Download toUpper2F.cpp
and complete as specified.
2. Download intToOctalF.cpp
and complete as specified.
Due Weds 10/30: Test Fri
1. Reading: Hubbard
sect 2.13 (Scientific notation & e-format)
2. Convert to binary (base 2): 45;
Convert to base 10: binary 110110
2. Programming [handwritten or hardcopy]:
1. Download intToBinary.cpp
and complete as specified.
2. Download octToDecimal.cpp
and complete as specified.
Due Thurs 10/31: Test Fri
1. Reading: Hubbard
sects 6.1 and 6.2 (Intro to arrays, processing arrays)
2. Programming [handwritten or hardcopy]:
1. Download binToDecimal.cpp
and complete as specified.
2. Download hexToDecimal.cpp
and complete as specified.
Due Fri 11/01: Test Fri
1. Programming [handwritten or hardcopy]: Download array.cpp
and complete as specified.
Due Mon 11/04: Test Fri
1. Reading: Litvin
pp. 35-39 (the apvector container class)
2. Programming [handwritten or hardcopy]:
1. Download array2.cpp
and complete as specified.
2. Download apVectorOps1A.cpp
and complete functions vecMean and seqSearch as specified
Due Weds 11/06: Test Fri
1. Litvin Exam A-1 (p. 129) #13-16 (You are responsible for all previously
assigned Litvin
multiple choice on every test!!
2. Programming [handwritten or hardcopy]:
1. In apVectorOps1A.cpp,
change return type of stdDev from int to double
before
completing stdDev. Note: standard
deviation = 8.027053
Due Thurs 11/07: Test Fri
0. Answers to array2.cpp posted
at array2S.cpp
(Note correction in
solution to 2nd largest)
1. Programming [handwritten or hardcopy]:
1. In apVectorOps1A.cpp
and complete sort function using selection sort algorithm
and complete medianMode
function.
Due Fri 11/08: Test Fri
0. To compare the relative performance of the selection and bubble sorts,
download sortShellS.cpp,
compile, run, and choose menu selection #6.
1. Programming [handwritten or hardcopy]:
1. Download apMatrix1.cpp
and complete sumMat and maxRow as specified.
Due Tues 11/12: Test Fri
0. To compare the relative performance of the selection and bubble sorts,
download sortShellS.cpp,
compile, run, and choose menu selection #6.
1. Programming [handwritten or hardcopy]:
1. In apMatrix1.cpp,
complete maxCol and swapCols as specified.
NOTE: sumMat = 164, maxRow: sum = 64
and index = 2, maxCol: sum = 51,
index =3
2. Reading: Hubbard sect. 6.4
(Array index out of bounds), 6.6 (sequential search algorithm,
and 6.11 (multidimensional arrays)
3. Group project:
1. Design it intelligently. An intelligent design will
facilitate the delegation
of abstract tasks to different members of
your group. Use prototypes with
preconditions & postconditions to help
everyone in your group understand what their
respective functions are expected to
accomplish and what assumptions can be
made can be made when implementing them.
2. Number and nature of the roots. Examples
6x2 + 5x - 21 = 0: {1.5,
-2.33333}, 2 real and rational roots
x2 + 10x + 25 = 0: {-5}, 1 real
and rational double root
3. Submit these items:
1. Hardcopy of program 2. Source code
and Windows-executable program
on diskette. 4.
Test data that exercises the program comprehensively.
Due Weds 11/13: Test Fri
0. To compare the relative performance of the selection and bubble sorts,
download sortShellS.cpp,
compile, run, and choose menu selection #6.
1. Programming [handwritten or hardcopy]:
1. In apMatrix1.cpp
complete binSearch and swapRows as specified.
2. Challenge: See if you can devise an elegant
solution to the mode
problem in apMatrix1.cpp.
You may assume that 0 <= v[k] < 50 for
k: 0 <= k < v.length()
2. Litvin: Bring Litvin to class or come with photocopy of A Exam 1
questions
7 and 12.
Due Thurs 11/14: Test Fri
0. In sortShellS.cpp,
Change global variable const int bestWorstSIZE from 2000 to
4000
and notice the difference doubling makes in the times of
bubble and insertion sorts.
1. Programming [handwritten or hardcopy]:
1. Download 93a1.cpp
and complete as specified.
Due Fri 11/15: Test Fri (Selection
sort, binary search, vector & matrix ops)
1. Programming [handwritten or
hardcopy]:
Download apvectorOps2.cpp
and complete bSearch and deleteVec as specified.
Note: Since deleteVec depends in bSearch,
complete bSearch first.
Due Mon 11/18:
0. Saturday, November 16 at 11pm ET on C-SPAN2 and
Sunday, November 17 at 8pm ET on C-SPAN2
If you have time, you might want to watch or tape:
KEN ALDER discuss his book, "THE MEASURE OF ALL THINGS: THE SEVEN
YEAR ODYSSEY AND HIDDEN ERROR THAT TRANSFORMED THE WORLD." It tells
the story behind the creation of the metric system and Jean-Baptiste-Joseph
Delambre and Pierre Francois-Andrew Mechain, the two French astronomers
who set out to create a standard system of measurement by equating the
distance of the meridian arc that runs from the North Pole to the Equator.
It was agreed that the meter itself would equal one ten-millionth of this
distance. Professor Alder discovered that the astronomers actually came up
short in their measurement, but that the effort they made produced
invaluable information about that shape and formation of the Earth.
Following his talk, Professor Alder answers questions from the audience.
1. Programming [handwritten or
hardcopy]:
1. In apvectorOps2.cpp
complete insertVec as specified.
2. Download classes1.cpp and complete sortByName and
AddOneThousand as
specified.
2. Reading:
1.
Hubbard sects 10.1 (intro to classes) and 10.2 (class declarations)
2. Hubbard: Read function Review Questions 5.1-5.3 and 5.7
thru 5.9.
See if your notions agree with the answers
given on p. 114
Due Tues 11/19: Test Fri
1. Programming [handwritten or
hardcopy]:
1. Acting as a client of a Customer class: Download classes2.cpp
and
complete bSearch and withdrawDriver()
as specified.
2. Reading:
1.
Hubbard sects 10.3 (constructors) and 10.5 (accessors)
2. Litvin: A-1 Exam questions 17-18
Due Weds 11/20: Test Fri
1. Reading:
1. Hubbard sects 5.14
(overloading), 13.1 (templates), 13.3 (function
templates)
2. Litvin: A-1 Exam questions 26-27
2. Programming [handwritten or
hardcopy]:
1. In classes3.cpp
implement all the free-standing boolean functions.
2. Acting as a client of a Customer class: In classes2.cpp
complete
deleteCustomer and averageBalance
as specified.
Due Thurs 11/21: Test Fri
1. Reading:
1.
Hubbard sects 10.6 (private member functions), 10.10 (structs)
2. Litvin: pp. 53-55 (templated and overloaded functions)
2. Programming [handwritten or
hardcopy]:
1. Acting as a client of a Customer class: In classes3.cpp,
implement all
the free standing functions
(they're all pretty short).
Due Fri 11/21: Test Fri (classes
and programming topics we've examined recently)
0. Answers to Customer class and
function template questions in classes3S.txt
1. Reading: For summary of what
we've covered: Litvin pp. 45-49
2. Programming [handwritten or
hardcopy]:
1. Acting as an implementer of the Complex class: Download
complex1.cpp
and complete the isEqual() and add()
member functions
Due Mon 11/25: No Test Fri
1. Reading:
1. Hubbard sect 11.4 (overloading arithmetic operators)
2. Litvin Exam A-1 #7, 11, 19
2. Programming [handwritten or
hardcopy]:
1. Acting as an implementer of the Complex class: In
complex1.cpp
complete member functions subtract, multBy,
recip, and divBy
Due Tues 11/26: No Test Fri
1. Reading:
1. Hubbard sect 11.7 (overloading stream operators)
2. Programming [handwritten or
hardcopy]:
1. Acting as an implementer of the Complex class:
a.In
complex1.cpp complete
functions raiseBy and isEqual
b.Download
complex2.cpp complete
operator functions +(), -(), *()
Due Weds 11/27: No Test Fri
1. Reading:
1. Hubbard sects 10.7 (copy constructor), 11.7 (re-read
overloading stream
operators)
2. Programming [handwritten or
hardcopy]:
1. Acting as an implementer of the Complex class: In
complex2.cpp complete
operator functions /(), ^() (exponentiaion)
2. Acting as an implementer of the Customer class: In
classes4.cpp complete
stream operator functions
operator<<() and operator>>(), overloading for
Customer class.
Due Mon 12/02 Test Fri
1. No
assignment: review and revise old HW assignments if necessary. Make
sure
the completed programs produce the correct output.
Due Tues 12/03: Test Fri
0.
Period 2 correction:
last statement
before bell was:
Customer *cp = Customer("Pat", 17.50);
Should have been: Customer *cp =
new
Customer("Pat", 17.50);
1. Reading:
1. Hubbard sects 7.3 and 7.4 (pointers) and 11.2
(overloading assignment
operator).
2.
Programming [handwritten or
hardcopy]:
1. Download and complete
pointer.cpp
2. Acting as an implementer of the Customer class: In
classes4.cpp
a. Complete overloaded =
operator which sets new private data member
wasAssigned
to true.
b. Change copy constructor to
set wasAssigned to false.
Due Weds 12/04: Test Fri
0.
Period 2 correction:
last statement
before bell was:
Customer *cp = Customer("Pat", 17.50);
Should have been: Customer *cp =
new
Customer("Pat", 17.50);
1. Reading: Hubbard sects 10.4(constructor initializer lists),
12.2 (composition)
2.
Programming [handwritten or
hardcopy]:
1. Download and complete 99a1.cpp
(apvector problem)
Due Thurs 12/05: Test Fri
1. Reading: Litvin Exam A-1 # 7, 11, 19
2.
Programming [handwritten or
hardcopy]:
1. Print 1995
Exam A question 2. Try to complete in 26 minutes or less
2. Download 95a2.cpp,
enter solutions for 95
Exam A #2 and run to validate.
Due Fri 12/06: Test Fri
1. Reading:
a. For test preparation: Hubbard p. 248 Review
Questions 10.1, 10.5, 10.8,
10.9, 10.11, 10.13, 10.15, 10.16
b. Hubbard sect 3.11 (switch stmt)
2.
Programming [handwritten or
hardcopy]:
a. Download apMatrixAP1.cpp
and complete sumBorder as specified
b. Due Monday: download magic.cpp
and implement Coxeter's magic squares algorithm
Due Mon 12/09: Quiz Thurs
1.
Programming [handwritten or hardcopy]:
a. In apMatrixAP1.cpp,
complete as specified
b. Download magic.cpp
and implement Coxeter's magic squares algorithm
Due Tues 12/10: Quiz Thurs
1.
Programming [handwritten or hardcopy]:
a. Print 1998
A Exam: question 1 or 98a1.txt,
and complete in 25 minutes or less.
b. Download 98a1.cpp
or 98a1.cpp
(different site), enter your solutions for
part a, and run program to
validate them.
Due Weds 12/11: Quiz Thurs
1. Reading:
a. Open apstring.cpp and read documentation for
variable npos
1. What is its data type and value?
2. What member function uses it and
how?
b. Read Litvin section 3.2.
2.
Programming [handwritten or hardcopy]:
a. If you lost hand out, print 1993
A Exam: question 3
and complete parts a
and b (part c not due until Thurs)
b. Download 93a3.cpp
or 93a3.cpp
(different site), enter your solutions for
parts a, and b (NOT part c) and run program to
validate them.
Due Thurs 12/12: No quiz (Test for Ryan and nobody else)
1. Reading: Hubbard
sect 13.3 (class templates)
2.
Programming [handwritten or hardcopy]:
a. In 1993
A Exam: question 3
and complete part c, enter solution in 93a3.cpp
and run program to
validate.
b. Download isMagic.cpp
and complete as specified.
Due Mon 12/16:
1. Reading: Hubbard
sect 13.4 (container classes)
2.
Programming [handwritten or hardcopy]:
a. Download 95a4.cpp
or 95a4.cpp
(different site), answer questions, and run
program to validate solutions.
Due Tues 12/17: Test Fri
1. Reading: a. Litvin
pp. 59-61 on input and b. Hubbard
sect 9.5 (files)
2.
Programming [handwritten or hardcopy]:
a. Download files1.cpp,
complete as specified, and run program to validate.
Due Weds 12/18: Test Fri
0.
Litvin pp. 59-61 on input if you didn't
get 5:15PM addition to 12/17 assignment
1. Reading: a. Litvin
p. 61 on output and Hubbard
sect 8.5: focus on
get function (for istream objects) and put function (for
ostream objects)
2.
Programming [handwritten or hardcopy]:
a. Download files2.cpp,
complete as specified, and run program to validate.
b. Download streams2.cpp,
complete parts 1-3 as specified, and run program to
validate. Note: part 4 is NOT
assigned yet. It's challenging & is amenable
to the istream/ifstream get function.
Due Weds 12/18: Test Fri
0.
Litvin pp. 59-61 on input if you didn't
get 5:15PM addition to 12/17 assignment
1. Reading: a. Litvin
p. 61 on output and Hubbard
sect 8.5: focus on
get function (for istream objects) and put function (for
ostream objects)
2.
Programming [handwritten or hardcopy]:
a. Download files2.cpp,
complete as specified, and run program to validate.
b. Download streams2.cpp,
complete parts 1-3 as specified, and run program to
validate. Note: part 4 is NOT
assigned yet. It's challenging & is amenable
to the istream/ifstream get function.
Due Thurs 12/19: Test Fri (no magic squares or recursion)
1. Reading: Litvin pp.
78-81 (recursion)
2.
Programming [handwritten or hardcopy]: If applicable to you,
do the programming
problems that you've done incorrectly, or enter and run any
recent assignments that
you haven't validated.
Due Fri 12/20: Test Fri (no magic squares or recursion)
1.
Programming [handwritten or hardcopy]: Download fibR.cpp
and complete
recursive and iterative versions. Note what happens when you
use recursive
version to find 45th Fibonacci number!
Due Thurs 1/02/03: (Results
for 12/20 test posted at
testList)
0. Droppable tests
for qualifying students:
testList
1. Reading & Multiple
Choice: Litvin Exam A1 #9-10, 16, 20-25, 28-36
2.
Programming [handwritten or hardcopy]: Download (from my web
site) files3.cpp
and complete all parts as specified.
Due Fri 1/03/03: Test next Fri
0. Droppable tests
for qualifying students:
testList
For solutions to files3.cpp, see
files3S.txt
1. Reading & Multiple
Choice: Litvin: re-read pp. 78-81 on recursion.
2.
Programming [handwritten or hardcopy]: Download natural.cpp
& complete
add, mult, and writeBwkd as specified.
Note:
for add and mult, you can use - operator when passing parameters.
Due Mon 1/06/03: Test Fri
0. Droppable tests
for qualifying students:
testList
For solutions to files3.cpp, see
files3S.txt
1. Reading & Multiple
Choice:
a. Litvin: Exam A-2 #1-4.
Bring Litvin to class every day
b. Recursion
(optional but helpful): Recursive
functions: I (skip problems
involving C++ and programming
concepts we haven't examined)
2.
Programming [handwritten or hardcopy]:
1. In natural.cpp, complete raise & implement a
subtract function that operates
under the same constraints as does
add, mult, and raise. Add driver that tests:
subtract(7, 4), subtract(7, 2),
& subtract(7, 1). You don't need 0 to
implement subtract, but use it if you
must.
2. Download fibR2.cpp
and complete both recursive Fibonacci functions.
New version should execute much more
rapidly than original as n increases!
Due Tues 1/07/03: Test Fri
1. Reading & Multiple
Choice:
a. Litvin: Exam A-2 #5-6.
Bring Litvin to class every day
b. Recursion
(optional but helpful): Recursive
functions: II Contains animated
Towers of Hanoi. Watch 3-disk and
4-disk solutions!!
2.
Programming [handwritten or hardcopy]:
1. Download and complete hanoi.cpp
as specified
2. Optional: Download nCr.cpp
and implement nCr recursively.
Due Weds 1/08/03: Test Fri
1. Reading & Multiple
Choice:
a. Litvin: Exam A-2 #7 Bring Litvin to class every day
2.
Programming [handwritten or hardcopy]:
1. Download and complete bSearch.cpp
as specified
2. Download nCr.cpp
and implement nCr recursively.
Due Thurs 1/09/03: Test Fri
1. Reading & Multiple
Choice:
a. Bring Litvin to class every day
2.
Programming [handwritten or hardcopy]:
1. Download and complete searchDebug.cpp
as specified.
2. Download isPal.cpp
and complete
as specified.
3. OPTIONAL: Download mazeANSI.cpp
and run to test whether your system
supports the program's screen
operations.
Due Fri 1/10: Test
1. Reading & Multiple
Choice:
a. Bring Litvin to class every day
2.
Programming [handwritten or hardcopy]:
1. Download and maxArray.cpp
and complete as specified.
2. Download mazeANSI.cpp
and run to test whether your system supports the
program's screen
operations.
Due Mon 1/13: Quest Fri
1. Reading & Multiple
Choice:
a. Bring Litvin to class every day
b. Litvin: Exam A-2 #8-10
2.
Programming [handwritten or hardcopy]:
1. Complete move() function in mazeANSI.cpp.
Use function printSpot() to update
screen whenever the state of the maze is
changed.
a. Note of order of moves: There are 24
possible sequences, hence many
different results
are possible. Here's a sampling of some:
1. right-up-left-down:
1417 moves
2. up-left-down-right:
925 moves
3. down-right-up-left:
473 moves
4. left-down-up-right:
473 moves
b. For information on how to use telnet to
log on to the school's system
& run program in
environment that will accurately display the changing
state of the maze in real
time, see: Using telnet to connect to the school
After you log on, copy
files with these commands:
1. cp /usr/local/classes/mcx1/jaye/mazeANSI.cpp
. <---(space
period)
2. cp /usr/local/classes/mcx1/jaye/90-APclasses/ap*
. <---(space
period)
For both commands, a. remember that Linux
is case-sensitive
b. make sure a period
.
is the last character
To edit the program, enter:
emacs mazeANSI.cpp
To compile the program, enter:
g++ mazeANSI.cpp
To run the program, enter: ./a.out
Due Tues 1/14: Quest Fri
0. Test Friday:
based on Litvin
multiple choice questions in Exam A-1
and 1-16 from Exam A-2
1. Reading & Multiple
Choice:
a. Will
be using Litvin Tues: bring it every day:
b. Litvin: Exam A-2 #11-13
2.
Programming [handwritten or hardcopy]:
a. If you haven't done so already, follow instructions
given for HW due 1/13
above to:
1. Use Telnet to log on to school's
computer network.
2. Copy files to your home directory.
3. Edit, compile (and link), and run
program in mazeANSI.cpp
b. Optional: Download knight.cpp
and complete as specified. Can be run
successfully under Windows.
Due Weds 1/15: Quest Fri Solution
to maze problem: mazeANSIS.txt
0. Test Friday:
based on Litvin
multiple choice questions in Exam A-1
and 1-16 from Exam A-2
1. Reading & Multiple
Choice:
a. Bring Litvin
to class
on
FRIDAY.
(Not needed Weds
& Thurs)
b. Litvin: Exam A-2 #14-16
2.
Programming [handwritten or hardcopy]:
a. Download knight.cpp
and complete as specified. Can be run successfully under
Windows.
Due Thurs 1/16: Quest Fri (Not
responsible for Litvin A-1 #24 & 32)
0. Class in room 411
1. Test Friday:
based on Litvin
multiple choice questions in Exam A-1
and 1-16 from Exam A-2. Not
responsible for Litvin A-1 #24 & 32.
2. Reading & Multiple
Choice:
a. Bring Litvin
to class
on
FRIDAY.
3.
Programming [handwritten or hardcopy]:
a. Log on to you school account,
compile & run mazeANSIS.cpp
program
on school's network.
Due Fri 1/16: Quest Fri (Not
responsible for Litvin A-1 #24 & 32)
0. Class in room 635
1. Test Friday:
based on Litvin
multiple choice questions in Exam A-1
and 1-16 from Exam A-2. Not
responsible for Litvin A-1 #24 & 32.
2. Reading & Multiple
Choice:
a. Bring Litvin
to class
on
FRIDAY.
|