MCX1 home

MCX1 Assignments for 2001 semester

Due Mon Jan 7: 
0.  input1S.cpp is now accessible: download it and run it and modify it (to see whitespace and getline in action).
1. Read Hubbard section 9.2 (formatted input) and 9.5 (files)
2. Download and complete files1.cpp and bring to class.
3. Time yourself: Litvin Exam  A1 #23, 26-30 in 12 minutes or less

Due Fri Jan 5:
 
Solutions: 95a4S.txt 00a3.txt
1. Quiz Fri: Based on Litvin A Exam 1: all questions that have been assigned.

1. Read Litvin section 2.5 (apstring class and getline)
2. Download and complete input1S.cpp
3. Optional: a. Read how to generate pseudo random numbers.
                    b. Write short program that uses Monte Carlo Method with rand() (stdlib.h) to approximate p

Due Thurs Jan 4:
 
Quiz Fri: Based on Litvin A Exam 1: all questions that have been assigned.
1. Read sects 12.1 and 12.2 (composition)
2. Download and complete construct.cpp

Due Weds Jan 3:
 
 
1. Buy Be Prepared for the AP Computer Science Exam and answer A Exam 1 #1-8,   11-20
2. Download and complete 95a4.cpp (the problem we started in class on Fri 12/21), and bring to class.
3. Download 00a3.txt and answer question in 25 minutes or less. Then enter your answers in 00a3.cpp to validate
    and bring to class.

Due Fri Dec 21:
 

1. Complete template1.cpp, due Weds ( if you haven't done so), and bring to class.
2. Complete 93a3.cpp due Weds ( if you haven't done so), and bring to class.

Re-test Thurs Dec 20: 
1. The driver for relevant member functions for which you're responsible: Rational1.cpp
    Download it and get them right or....
2. Download what you did in the lab by finding Windows Run command and entering: telnet ernie.stuy.edu
    or by using SHS Squirrel mail and sending yourself Rational1.cpp as an attachment
    See:  1. Essential Linux and Emacs commands    2. Connecting to SHS with telnet

Due Weds Dec 19:
 

0. Bring 1998 Exam A Question 1 (that was due Mon) to class
1   a. Read StringType ADT question handed out in class and answer completely
      b Download 93a3.cpp, enter your answers for StringType ADT question, run program to validate, and bring to class.
2. Download template1.cpp, complete templated selection sort, run to validate, and bring to class.

TEST Tues Dec 18:
 
Classes, templated functions (but NOT class templates)

Due Mon Dec 17:
 
(Thurs solution: complex4S, solution to 1995 A 2: 95a2S)
0. Test Tues. classes, templated functions (but NOT class templates)
1. Read sections 13.1 (templates) and 13.2 (function templates), and 13.3 (class templates),
2. Print out 1998 Exam A: Question 1 and answer question in 25 minutes or less.
3. Download 98a1.cpp, enter your solutions for 1998 Exam A Question 1, and bring to class.

Due Fri Dec 14:
 
(Do Thurs assignment first)
1. Read section 11.5 (overloading the arithmetic assignment operators) and Review Question 10.6
2. In complex4.cpp , implement the overloaded assignment operator, operator=, and bring to class.
3. In complex4.cpp , implement the overloaded arithmetic assignment operators:  +=, and -=, *=, and bring to class.
Due Thurs Dec 13:
 
(Thurs solution: complex3S)
0. NOTE on complex4.cpp: A re-revised version was uploaded at 3:45PM. Test the operator^ function
    only after implementing the operator= function.
    NOTE on complex3.cpp: Correction: istream &operator>>(istream &is,
const Complex &r)
   should be: istream &operator>>(istream &is,  Complex &r)               
1. Read sections 11.2 (overloading the assignment operators) and 11.3 (The this pointer)
2. Read Review Questions 11.1 thru 11.4 and make sure you can answer these questions!!
3. OPTIONAL In complex4.cpp , implement the overloaded = operator.
4. REALLY OPTIONAL on pointers. Read 7.3 and 7.4. Download pointer.cpp and complete.

Due Weds Dec 12:
 
(Mon solutions: complex2S, 95a2S)
0. NOTE: complex4.cpp was updated at 4PM Tues. If you downloaded this earlier and didn't implement
    and of the code, you're better off downloading the new and improved version.

1. Download complex3.cpp and complete overloaded << and >> stream operator functions, and bring to class.
2. Download complex4.cpp and complete ^ operator and copy constructor, and bring to class.

Due Tues Dec 11:
 
( Mon solutions: complex2S)
0. Quest Tues: member functions, overloaded operator functions
1. For Quest: Read Hubbard's Review Questions 10.1 thru 10.5, 10.8 thru 10.14 and make sure you know the answers!!
2. For Quest: Read section 11.7 (overloading stream operators)
3. OPTIONAL (will be due Thurs) Download complex3.cpp and complete overloaded << stream operator function.

Due Mon Dec 10:
 
(Fri solutions: complex2S)
0. Quest Tues: member functions, overloaded operator functions
1.The complex2.cpp you downloaded for Fri had three different kinds of  errors:
    1. The name of parameter of the overloaded boolean operator functions was missing.
    2. The getAV absolute value function is called absVal
    3. The use of const member function was not consistent enough to pass the scrutiny of the compiler.
    A. The missing  parameter name and the problem with const member functions has been resolved.
    B. The use of the name absVal has been retained.

   Therefore, you may want to try the short programming assignment due Fri again. 
2. Download the corrected  complex2.cpp,   complete the overloaded arithmetic operator member functions, and bring to class.
3. Read section 11.4 (overloading arithmetic operators)
4. Print out 1995 AP A Exam: Question 2 and try to solve it in 25 minutes or less. Then download 95a2.cpp and
     enter your code to validate your solutions and bring to class.

Due Fri Dec 7:
 
(Thurs solutions: complex1S)
1. Read sections 11.1 (Introduction to overloading operators), 11.6 (overloading relational operators)
2. Download complex2.cpp   and complete overloaded operator functions ==, !=, >, >=, and +

Due Thurs Dec 6:
 

1. In complex1.cpp, complete isGreater, isGreaterOrEqual, isLess, and raiseBy and bring to class.
    a. Note on the boolean funtions: Assume that a + bi > c + di means |a + bi| > |c + di|
    b. Note on raiseBy: Remember that X.multBy(Y) doesn't change anything unless you assign the return value:
                 X = X.multBy(Y)

2. In complex1.cpp, add copy constructor (section 10.7) to Complex class declaration,  implement it, and bring to class.
3. Read section 10.8 (class destructor)

Due Weds Dec 5:
 
(Do Tues. assignment first)
1. Read section 10.7 (copy constructor), 10.10 (structs)
2. In complex1.cpp, complete getAV, recip, divBy, and isGreater and bring to class.

Due Tues Dec 4:
 
(Mon. solutions: 99a1Sclasses2S)
0. Quest Tuesday: classes: constructors, access specifiers, implementing constructors & member functions,
   const member functions
1. Read section 10.6 (private member functions), 10.10 (structs)
2. Download  complex1.cpp complete the specified work, and bring to class.
3. In 99a1.cpp, complete part c and bring to class. NOTE: In this problem, a StudentInfo struct is equivalent to
    a StudentInfo class.

Due Mon Dec 3:
  (Fri solutions: classes2S: for averageBalance: mean = 1602.98, largest = 7000.00, smallest = 15.15)
0. Quest Tuesday: classes: constructors, access specifiers, implementing constructors & member functions,
    const member functions
1. Read section 5.4 (overloading), 10.4 (constuctor initializer lists), 10.5 (access functions)
2. In classes2.cpp complete addCustomer and bring to class.
3. Download 99a1.cpp, complete parts a and b, and bring to class. NOTE: In this problem,
   
a StudentInfo struct is equivalent to a StudentInfo class.

Due Fri Nov 30:
 
0. Read section 3.11 (switch statement)
1. In classes2.cpp complete averageBalance and deleteCustomer and bring to class.

Due Thurs Nov 29:
 
(Solutions: classes1S )
Quiz Thurs: Searching and selection sort. This assignment should help you prepare for it!!
1. In classes1.cpp which you started yesterday, complete sortByBalance and bring to class. (selection sort)
2. Download classes2.cpp and complete bSearch and withdrawDriver and bring to class. (binary search)
3. OPTIONAL: In classes2.cpp, complete addCustomer for an application of the sequential search.

Due Weds Nov 28:
 
(Solutions: sSortS and apmatrixAP1S)
Quiz Thurs: Searching and selection sort
0. Observe animated demonstration of selection sort algorithm: The orange line segment represents
     the current position (currentPos) and the blue line segment represents the successive
     positions being compared against value at v[minPos
]
1. Read Hubbard sects 10.1, 10.2, and 10.3 (on classes)
2. Download classes1.cpp and complete 1st two functions: sortByName and addOneThousand


Due Tues Nov 27:
 
(Mon solution: apmatrix1S)
1. Download sSort.cpp, implement the selection sort algorithm as specified, and bring to class.
2. Download apmatrixAP1.cpp, complete as specified
   (this is NOT apmatix1.cpp) and bring to class.
3. Order or purchase Be Prepared for the AP Computer Science Exam before December 1.
    If it's not at your local B&N or college bookstore, order from Amazon, B&N online,
    or Skylight's web site.

Due Mon Nov 26: (Solutions: 93a1S)
1. Optional: download revised  93a1.cpp   to see if your posOf2nd works for special case
2. Download apmatrix1.cpp and complete the functions as specified  and bring to class (this will require some time).

Due Weds Nov 21:
 

1. (a) Print 1993 Exam A: Question 1  (b) Read the question  (c) Write answers in no more than 25 minutes
2. Download 93a1.cpp, type in your solutions to 1993 Exam A: Question 1 and bring to class (or bring written version)

Due Tues Nov 20:
 
(Solutions: seqSearchS and triples3S)
0. Half-period vector test Tues. Also see notice above about what to do if this web site crashes.
1. Re-read 6.6 (linear search) and 6.8 (binary search algorithm)
2. Download binSearch.cpp, complete as specified, and bring to class.
3a. If you downloaded isSorted.cpp before 5PM Tues, download corrected version.  (Thanks Jose)         
3b. Download isSorted.cpp, complete as specified, and bring to class.
Due Mon Nov 19:
 

0. Half-period vector test Tues. Also see notice above about what to do if this web site crashes.
1. Re-read 6.4 (index out of bounds)
2. Read 6.6 (linear search) and 6.8 (binary search algorithm)

3. Download seqSearch.cpp, complete as specified, and bring to class.
4. Optional: Download isSorted.cpp, and complete as specified. (DUE TUES)

Due Fri Nov 16:
 
Do Thurs assignmet 1st
1. Download vector1.cpp, complete as specified, and bring to class.
2. If you lost APCS Exam Quick Reference, print it out again and bring to class.
3. If you're curious and want to work ahead: vector2.cpp and vector3.cpp

Due Thurs Nov 15:
 
(Tues solutions: stringOps2S, ref1S)
0. Download vector1.cpp and try to build and execute it as is. You do NOT have to complete it!
1. Complete  array.cpp and bring to class.
2. Optional: Find an alternate (and better) solution to rotateN than one developed in class.
3. Optional: Last chance for triples3.cpp challenge and triples3.cpp output

Due Weds Nov 14:
 

1.  Read sects 6.1 thru 6.4
2. Optional: Find an alternate (and better) solution to rotateN than one developed in class.
3. Optional: This will be assigned tomorrow:  array.cpp

Due Tues Nov 13:
 
(Fri solutions: stringOps2S and triples2S.cpp )
1.  Read sects 5.10 (passing by reference) and 5.11 (passing by constant reference)
2. Complete stringOps2.cpp function rotateN and bring to class.
3. Complete ref1.cpp (Dev-C++ users may want to execute this on another system since the Dev-C++ compiler
     fails to point out errors, in some cases, when reference parameters are used incorrectly.
4. Remember triples3.cpp challenge and triples3.cpp output.

Due Fri Nov 9:
 

1. Complete stringOps2.cpp functions rotate1 and rotateAll and bring to class.
   HINT: Diagram examples of rotate1 to plan your solution BEFORE you start to code it: plan comes BEFORE code!!!
2.  Improve your completed triples2.cpp in the following ways:  and bring to class.
     1. It only prints primitive triples
     2. Define a gcd function that simplifies the task of testing whether m and n are relatively prime
     3. Define a print function that prints every triple
         prototype: void print(int n, int m2, int n2, int a2, int b2, int c2);
          usage in program for triples2.cpp: print(count, m, n, a, b, c); 

3. Challenge: triples3.cpp Printing triples--all of which have a hypotenuse which is a perfect square--without testing
     to see if the hypotenuse is a perfect square
. Hint: use formula creatively and more than once!!!
    For expected output, see triples3.cpp output

Due Thurs Nov 8:
 

1. Complete listAmicable function (problem 3 in perfect.cpp) and bring to class.
2. Complete triples2.cpp from Source code page or from  temporary web page and bring to class.
TEST Weds, Nov 7:
 
(see details above)
As of 5:30PM Nov 6: base2decimalS.cpp and other files back online at source code

Due Mon, Nov 5:
 
(test Weds: see details above)
   Error in base2Decimal.cpp's testBase function:
    base2Dec(outPut(k,
2), base) should be
    base2Dec(outPut(k,
base), base)

1. Download and complete triples1.cpp (nested repetition) and bring to class.
2. Download and complete problems 1-2 in perfect.cpp (repetition in functions) and bring to class.
   You are NOT responsible for problem 3. Feel free to work on problem 3 (amicable numbers).
3. Modify your solution to substrCount() in stringOps.cpp (from Weds) by accomplishing the
   same task without using substr member function and bring to class.


Due Fri, Nov 2:
 
(Solutions to toBinaryS.cpp, toUpperS.cpp, toRadixS.cpp)  WILL BE POSTING SHORTLY
0. Try connecting to SHS directly: See Using telnet  
1. Test Weds Nov 7 (See details above)
2. Download and complete toRadix.cpp (improve it if you've already completed it) and bring to class.
3. Represent string to integer algorithm reviewed in class with flowchart and bring to class.
3. Download and complete either bin2decimal.cpp or (for the more adventurous) base2decimal.cpp and bring to class.

Due Thurs, Nov 1:
 
(Solutions to stringOpsS.cpp)
0. Try connecting to SHS directly: See Using telnet  
1. Download and complete  toUpper.cpp
2. Download and complete either:
     a. toBinary.cpp (just converts decimal to binary form) or for the more adventurous...
     b. toRadix.cpp   (converts decimal to base:  1 < base <= 10...

Due Weds, Oct. 31:
 
(Solutions to Tues assignment: powerFactS.cpp: Per 7 myPow2 okay now)
0. Try connecting to SHS directly: See Using telnet  
1. Download and complete stringOps.cpp

Due Tues, Oct. 30:
 
(Solutions to Mon assignment at gcdS.cpp and gcd2S.cpp)
Test Tues
:  POSTPONED UNTIL TUES NOV 5
1. Read Hubbard sects 5.1 (modularization), 5.3 (user-defined functions), 5.4 (test drivers)
   and 5.5 (function declarations and definitions)
2. Download and complete powerFact.cpp
 

Due Mon, Oct. 29: 
(William Chen's correction to Weds Oct 23 HW:  string3.cpp)  
0. Test Tues:  POSTPONED UNTIL TUES NOV 5
1. Download, compile, and debug debug.cpp (It's there this time!!)
2. Download and complete gcd.cpp
     1 Implement Euclid's algorithm with a while loop and without a break statement

     2. Note about Friday's  flow chart: The decision must be adapted to the needs of your while loop
2. Download and complete gcd2.cpp   

     1. Implement Euclid's algorithm with  for loop and with a break statement
     2. There should only be ONE statement that computes the remainder, r

     3. Note: This version would NOT reflect the logic flow of Friday's flow chart!!
  

Due Thurs, Oct. 24: 
(Solution to HW due Weds at string2.cpp)  
1. Read Hubbard sect 4.4 (the for loop) and 4.5 (the break statement)
2. Download, compile, and debug debug.cpp
3. Download and complete fib.cpp
Due Weds, Oct. 23: 
(Solution to HW due Tues at stringTestS.cpp and char.cpp)  
1. Complete string2.cpp

Due Tues, Oct. 22: 
(Solution to HW due Mon at average2S.cpp)
A. 307 computer lab is opened before 7:30AM on every day 
B. Mr. Jaye will be tutoring in
somewhere every Tues from  3:00 to 4:30  starting 10/30   

0. The ASCII collating sequence is listed in Hubbard p. 342
1. Read Hubbard sects 9.2, (the cin input stream object and the >> operator)
    9.4 (member functions length(), find(), but NOT replace()--we'll use substr() instead)
2. Use your browser to select and save stringTest.cpp. Then complete and run the program as specified therein.
    Remember that if apstring st equals "ABCDE"
     st.substr(0, 3) = "ABC", st.substr(1, 3) = "BCD", and st.substr(3, 2) = "DE"
To be reviewed Tues
3. Download and run char.cpp. Then write code to solve the two given problems. Do the
    best you can (which should be good enough) til we review it on Tues.

Due Mon, Oct. 22: 
(Solution to HW due Fri at average1S.cpp)
1. Print out AP Class Quick Reference at http://www.collegeboard.org/ap/computer-science/html/quick_ref.htm
    This contains summary of the apstring class and the other 5 AP classes. Focus on apstring accessor
   
functions length() and substr(), both of which we reviewed in class.  
2. Use your browser to select and save stringTest.cpp. Then complete and run the program as specified therein.
3. Read sect. 4.3 (do/while loop) and answer Review Problem 4.4
4. Write program that uses sentinel-controlled loop to achieve the output shown in these  two examples:

EXAMPLE 1                                                  
Finding an average
                                         
Enter score (-77 to quit): 100                     
Enter score (-77 to quit): 99
                                                                             
total = 199
average = 99.5

EXAMPLE 2
Finding an average  
Enter score (-77 to quit): -77

No basis for average

Due Fri, Oct. 19: 
1. Compile and run q7_8.cpp
2. Write program that achieves the output shown in these  two examples:

EXAMPLE 1                                                   EXAMPLE 2
Finding an average
                                     Finding an average      
Enter number of scores: 2                            Enter number of scores: 0
Enter score 1: 100                                        
Enter score 2: 99                                        No basis for average
                                                                             
total = 199
average = 99.5

 
Due Thurs, Oct. 18:
 
0. Solution for HW due Tues 10.16 at ascending.cpp
1. Read Hubbard sects 4.1 (while loops) and 4.2 (the break statement and exit function).
2. Review questions 4.1 thru 4.5. Hint concerning 4.5: The problem is a logic error. Find it and correct it.
3. Problem 4.7 (short program utilizing while loop)

Due Tues, Oct. 16:
(Test moved back to Weds--See bulletin above)
0. Test postponed until Weds due to scheduling problem on Tues
1. Read Hubbard sects 2.8 (compound assignment), 2.10 (type casting), and 2.14 (scope).
2. Complete short program that prints the values of x, y, z in ascending order x <= y <= z. Do
     not use assignment in your answer

    int main() {
         int x, y, z;
         cout << "Enter x, y, z (spaces between values): ";

         cin >> x >> y >> z;
          //YOUR CODE:

         return 0;
    }
       
3. Complete fragment that swaps values in x and y without additional variables:
    
       int x, y;
       cin >> x >> y;
       x = x + y;
   
Due Mon, Oct. 15:
(Do Friday's HW first)
0. Test Tuesday (see MCX1 Bulletins above)
1. In ten minutes or less, try to debug debugQuad.cpp as per the instructions given therein. The
     program contains one run-time (logic) error .
2. Modify the triangle classification program in this manner:
    1. Use C++ decision-making facilities  to sort a, b, and c in ascending order ( a <= b <= c)
        before you classify triangle
    2. Utilize the fact that no length is greater than c to simplify the classification by angle
         part of your program.
         FOR EXAMPLE: If you know that no length is greater than c, the condition for determining
         whether the lengths form a right triangle can be reduced to  (a*a + b*b == c*c) !!!
3. Do Hubbard Review Questions #3.1--3.5, 3.8--3.10, 3.11a--c, 3.12a, and 3.14. These questions
    should  help you prepare for test on Tuesday.

Due Fri, Oct. 12:
0. Solution to HW due Thurs Oct 10 at triClass.cpp
1. Modify triangle classification program to enable it to classify the number and nature of the roots
   of ax2 + bx + c = 0 and to print out imaginary roots using this test data (or your own) to validate your
   solution.
(Bring source code)

   SAMPLE OUTPUT:
    Enter a, b, c (spaces between values): 2 1 -6

    SS = {-2, 1.5}
    2 real and rational roots

1. x2 + 3x – 28 = 0   {4, –7}, 2 real and rational roots
2. x2 + 5x  = 0   {0, –5}, 2 real and rational
3. 2x2 + x – 6 = 0  {–2, 1.5} 2 real and rational 
4. x2 – 2 = 0  {–1.414213, 1.414213}, 2 real and irrational
5. 4x2 – 36x  + 81= 0  {4.5}, 1 real and rational double root
6. 4x2 – 100= 0  {–5, 5} 2 real and rational
7. x2 - 6x + 25 = 0   {3 + 4i, 3 - 4i}, 2 imaginary roots
8. x + 5 = 0 INPUT ERROR: no quadratic equation if a = 0

Due Thurs, Oct. 11:
0. Scan the following in Hubbard and make note of these very helpful sections for future reference:
    A. A list of important functions declared in math.h, p. 89
    B. Appendix C: Standard C++ operators listed in order of precedence, pp. 351-352
   C. Appendix F:  A list of C++ library functions,  pp. 396-400
1. Complete triangle classification program and use the test data given below to validate your solution program.
   a. NOTE: The triangle inequality is a sufficient test. If one or more lengths of a candidate triangle is non-positive,
         the lengths cannot pass the triangle inequality test!!! EXAMPLE {4, 0, 4} fails since 4 +0 > 4 is false.
     b. ADVICE concering the acute condition: When classifying by angle, use else to classify acute cases.

    if ( <obtuse condition> ) { cout << "triangle is obtuse\n"; }
       else if ( <right condition> )  { cout << "triangle is right\n"; }
       else { cout << "triangle is acute\n"; }

    c. CHALLENGE concerning the acute condition: Once you've validated your program, use if to classify acute case.
       if ( <acute condition> ) { cout << "triangle is acute\n"; }
        else if ( <obtuse condition> ) { cout << "triangle is obtuse\n"; }
        else { cout << "triangle is right\n"; }

     TEST DATA:  {5, 14, 12} : scalene and obtuse

                              {5, 18, 12}: sides don't form a triangle
                              {13, 5, 12} :scalene and right
                              {12, 5, 12}: isosceles and acute
                               {7, 7,  7}: equilateral and acute
                               {-5, -5, -5}: sides don't form a triangle

Due Weds, Oct. 10:
1. Read Hubbard sects 3.5--3.10 and focus on: statement blocks (sect 3.5), short-circuiting (3.7)
    and nested if statements (sect. 3.9).
2. Review Example 3.16 on p. 47 for the typical C++ approach to the grade conversion HW problem.
3. Revise quadratic formula program that uses decisions to prevent:
    a. division by zero when user enters 0 for quadratic coefficient a

    b. taking the square root of a negative number
    Review the three examples below and apply what you've learned about if stmts to achieve the specified output.
                                                                        3 SAMPLE OUTPUT EXAMPLES
Enter a: 0
Invalid input: a can't be 0


Enter a: 1
Enter b: 0
Enter c: 1

Roots are imaginary
Enter a: 2
Enter b: -1
Enter c: -6

SS = {-1.5, 2}


Due Tues, Oct. 9
 :
Using an if/else if//else if/else decision structure, write a grade conversion program that converts a numerical grade to a letter grade WITHOUT using logical operators &&, ||, or !

1. SAMPLE OUTPUT:
_____________________________________________________________
Grade Conversion Program

Enter numerical grade: 91
Letter grade is: A
_____________________________________________________________
2. SPECIFICATIONS

    RANGE              LETTER GRADE
  x
> 100                         Invalid
90 <= x <= 100                       A
80 <= x < 90                         B
70 <= x < 80                         C
65 <= x < 70                         D
  -1 < x < 65                         F
    x = -1                            Z (Medically excused)


Due Fri, Oct. 5  (do Thurs assignment first)
1. Read Hubbard sects 3.1 thru 3.5 or Deitel sects 2.4 thru 2.6
2. Use  short program that states whether or not a number is:

       a. positive or not positive
       b. an integer or not an integer
       c. has absolute value less than 10 or greater than or equal to 10
   Do __not__ use &&, ||, or ! operators to implement your solution
   Bring your source program to class.
-----------------------------------------------------------------------------------------------------------------------------
     EXAMPLE:    Enter x: 4.1                  Enter x: -22
            4.1 is positive              -22 is not positive
            4.1 not an integer           -22 is an integer
            |4.1| < 10                   |-22| < 10
is false
----------------------------------------------------
3. Write short program that rounds non-negative integer to nearest 10 and nearest 100
     EXAMPLE:     7538 to nearest 10 = 7540 and 7538 to nearest 100 = 7500
                               7583 to nearest 10 = 7580 and 7583 to nearest 100 = 7600
   Do _not_ use if statements to solve this problem!!  
    Bring your source program to class.

Due Thurs, Oct. 4
  (do Weds assignment first)
Write short program that finds minimum number of total coins required to realize the given $ amount.
Do this in terms of quarters, dimes, nickels, pennies. Do __not__ use Susan B. Anthony dollar coins!!
Bring your source program to class.
SAMPLE OUTPUT:
--------------------------------------------------------------------------------
Finding minimum number of total coins to realize $ amount

Enter $ amount: 1.68


quarters = 6
dimes = 1
nickels = 1
pennies = 3

Total # of coins = 11
-------------------------------------------------------------------------
    
Due Weds, Oct. 3
 
0. Dev-C++ instructions: Building simple programs and Setting Up Dev-C++ for the AP classes  USE THEM!!
1. Read Hubbard sects 5.1-5.2 (focus on sqrt, pow, ceil, floor, fabs)

2. Write program that uses quadratic formula to solve quadratic equations.
     Bring your source program to class.
SAMPLE OUTPUT:
--------------------------------------------------------------------------------
Using quadratic formula to solve ax^2 + bx + c = 0

Enter a: 1
Enter b: 3
Enter c: 28

x1 = 4
x2 = 7

-------------------------------------------------------------------------------------
Test Data:
    1. x2 + 3x – 28 = 0   {4, –7}                                
    2. x2 + 5x  = 0  {0, –5}
    3. 2x2 + x – 6 = 0  {–2, 1.5}        
    4. 4x2 – 36x  + 81= 0  {4.5, 4.5}
    5. 4x2 – 100= 0  {–5, 5}
    6. x2 – 2 = 0  {–1.414213, 1.414213}

    7. x2 + 1 = 0   How does your system respond to this data?

 Due Mon, Oct. 1
  (If you borrowed a CD, please return it on Monday, with an additional copy if possible!!)
1. Read Hubbard sects 2.10--2.13 and answer Review Questions 2.1--2.3 (on p. 32)

  OR Deitel & Deitel p. 79, 167--168.
For #2 recall these formulas:  a. C = 2pr    b. A = pr2
2. Write two C++ programs as specified below. Let p = 3.14 for the sake of validating your programs easily
    a. A program that finds the circumference of a circle given its radius.
    b. A program that finds the circumference of a circle given its area.
   Bring your source programs to class.
Due Fri, Sept. 28

1. Read Hubbard sects 2.1, 2.2, 2.4 through 2.7 and 2.9
OR Deitel & Deitel 1.20, 1.21, and 1.22
2. Fill out one of the two blank Developement Cycle flowcharts you received in the Development Cycle handout.
   If you lost the handout, print it out at Development Cycle handout
Due Mon, Sept. 24
1. If you weren't informed about HW assignment due Thurs Sept 20, complete it as specified at Previous HW

2. If you completed the assignment, start reading 1st few sections of Deitel & Deitel's Chapter 2
3. Consider downloading Cygwin for Windows-based computers with decent connection.
4. For Mac and Windows systems: Consider Metrowerks CodeWarrior LE Version 2.0 (Learning Edition)
Due Thurs, Sept. 20
1. Read Hubbard pp. 5-9; On p. 9 answer Review Problem #1.1 thru 1.10

2. Read Chapter 1 of C++:How to Program at your local B&N or Borders or read it online at Chapter 1
    a. Take Chapter 1 True or False online quiz and submit it for a grade at that website. Request that result
         be emailed to you.
    b. Take Chapter 1 Matching online quiz and submit it for a grade at that website. Request that result
         be emailed to you.
    The results of the quizzes will be known only to you and the C++:How to Program website!!   
    When you submit your True/False or Matching answers for the quizzes at the C++:How to Program website,
     your request may be refused. If so, try later. Submit a quiz with NO answers before you take the trouble to enter any! 
Due Mon, Sept. 17 Start on Thursday's assignment as soon as you can!!
1. Read Hubbard pp. 1-5 (Up to section 1.5)

2. Try downloading Cygwin if you don't have a C++ compiler and you do have a decent connection.
3. See Homework assignments for previous assignments.
Due Tues, Sept. 11
1. Review class notes on directory operations in Linux

2. Check Monday's assignment for last-minute additions that may have been made after you visited it (mea culpa).
Due Mon, Sept. 10

1. In Case Study document: 1. Read Introduction and Background (p. 6) , and pp. 7-12

2. Proceed with downloads listed under Course requirements below.
3. Purchase Purchase Hubbard's Programming with C++, 2nd edition as soon as possible.
4. Review Essential Emacs and Linux commands.
Due Thurs, Sept. 6
1. Print (don't downloadCase Study document: Part I  (just Part I) and read it.

2. Proceed with downloads listed under Course requirements below.
3. Purchase Purchase Hubbard's Programming with C++, 2nd edition as soon as possible. (It goes out of stock quickly)

Course requirements:

1. Purchase Hubbard's Programming with C++, 2nd edition. (In Schaum's Outline series)
2. Download Case Study document
3. Download AP class files and files for Part 1 of the Case Study
4. Read Part 1 of the Case Study and complete all exercises
5.  By November 1: purchase Litvin's Be Prepared for the AP Computer Science Exam

Useful sections in Programming With C++, 2nd Edition
     1.
functions in math.h: Listing and description, p. 89
     2.
ASCII codes: Includes review of escape character and escape sequences, p. 342
     3.
C++ operators: Listing, with descriptions, in order precedence, p. 351
     4.
C and C++ functions: Listing and description of the basic ones, p. 396
         Somewhat misleadingly titled "Standard C Library", the section also includes functions unique to C++.

 


MCX1 home