|
CS212 Computer
Programming II, Spring'08
- Syllabus
- Course
Policies
- Link
here
to course
pack
- Reference
links
- Code
in classroom
- Assignments (Hand in the
hard copies of the programs and the program execution with
input/output, and send me the codes through E-mail as attachments.)
- Assignment 1 (Due: 1:30pm,
Wed. Feb. 6):
- 1) Write a program that prompts a message and lets the user input
natural numbers. The program will quit when a negative number is typed
in. The program will output the following results to the screen:
average value (display to one decimal place) and the largest number
typed in. Don't use arrays for this program.
- 2) Use arrays for the last question. Also, output the smallest
number the user inputted. Using functions is recommended.
- Assignment 2 (Due: 1:30pm,
Wed. Feb. 13): Write a program to read
students' information (name, age, test1, test2, and final), and output
each student's average, class average, and the average age of students.
Total points for each test is 100 and that for the final is 200. Use struct to
define the student type. Display to the first decimal place.
- Assignment 3 (Due: 1:30pm,
Wed. Feb. 20): Define a Student
class with the following data members: name, age, test1,
test2, and final. Its function members are defined as needed. Use the
class and redo the questions of the last assignment.
- Assignment 4 (Due: 1:30pm,
Wed. Feb. 27):
Fraction Calculator - write a program to read two fractions and an
operator +, -, *, or /, perform the operation, output the result. Define a Fraction
class, and design nice interface. To get bonus (20%), reduce the results of
numerator/denominator to the lowest order.
- Assignment 5 (Due: 1:30pm, Wed.
March 26):
Write a C++ program that includes a string (single string without spaces) List class and its driver. The program will perform the following operations (use a loop so the user can run the code continuously):
1) insert a string; 2) find a string; 3) print the string list; 4) sort the
list to ascending order;
5) quit. Hint: refer to the code in page 185.
- Assignment 6 (Due: 1:30pm, Wed. April 2):
Write a C++ program that includes a name (first name, middle initial, and
last) List class and its driver. The program will perform the following operations (use a loop so the user can run the code continuously):
1) insert a string; 2) find a string; 3) print the string list; 4) sort the
list to ascending order;
5) quit. Requirement: design a nice and user friendly
interface.
- Assignment 7 (Due:
1:30pm, Wed. April 9): using library files vector
and algorithm, write a program to perform the following operations
for a string vector: insert a string to the vector, delete the last string,
sort the vector to ascending order, sort it to descending order, print the
number of the strings in the vector, reverse the strings order in the
vector, empty the vector. Requirement: design a nice and user friendly
interface.
- Assignment 8 (Due: 1:30pm,
Monday, April
21):
- 1) With overloading operators (+, -, *, /), redo assignment 4.
- 2) With templates, convert the List class in Assignment 6 to
a template, so the user can perform char, int, or
(single) string
operations. Requirement: design a nice and user friendly
interface. Bonus: add more operations for the lists.
Topics
covered
- Review:
loops, if-statement, data types
- C++
struct
- More
on struct with a loop.
- Classes:
define a Student class - objects, dot-notation, data/function members
- More
on classes: client code or driver to test the Student class. time ADT
- Member
functions for TimeType: Increment, Equal, GreaterThan
- Fraction
class
- List
ADT and implementation - List class
- Worksheet
(click here)
- Worksheet
2 (click here). Review C++ struct. Check
and Fraction classes
- Test I
- More
on the unordered lists: sequential search and selection sort
- Binary
search for sorted lists. Lab - on the name and ssb list (p.144-145, and
p.187-188)
- C-strings:
declaration and initialization, assignment, comparison, and length
- OOP
inheritance: declare a subclass
- Using
vector
and algorithm. Studying Point (base) and Pixel (sub)
classes
- OOP
composition: TimeCard and Line classes
- Overloading operators
+, -, *, and / for Fraction class. Using templates for functions
and classes
- More
on templates for classes
Worksheet
2 (answer key here). Pointers (p.172-173)
Test
II (answer key)
More
on pointers - dynamic allocations
Memory
leak. Linked lists
Create
a linked list. Recursion
© Since 2000,
Dr. John Wang, Virginia Wesleyan College, 1584 Wesleyan Drive, Norfolk/Virginia
Beach, VA 23502
Updated on Monday, May 05, 2008 03:06:51 PM
by zwang@vwc.edu
http://www.vwc.edu/~zwang/cs212
|