1. Define a class called Counter whose objects count things. An object of this class records a count that is a nonnegative integer. Include methods to set the counter to 0, to increase the count by 1, and to decrease the count by 1.
2. Define a Complex class with complex addition.
3. What is Abstract Data Type (ADT)?
4. What is "Overloading"? Why is it useful?
5. Write a program to implement a method that can do additions of 2 fractions. You will implement a class called Fraction consisting of a numerator and a denominator.
6. Design a method that can compute the vector inner product. You must define Vector class in the first place. Write a demo program to verify your program works.
沒有留言:
張貼留言