CPS 6, Ramm - Spring 2000 - 2/25/00 #16
- Announce
- Quiz Next Friday (3/3/00)
- Group Work (more in future)
Chap 7. Class Interfaces, Design, and Implementation
- Work on Class Design: The Quiz Class
-
First look at traditional style program
-
simpquiz2.cpp
- Consider a Class Design: Requirements
- More than one kind of question
- Several students share keyboard
- More than one chance to answer
- Class Design: Assigning Responsibilities
- Student
- Construct using name
- RespondTo a question
- GetScore
- GetName
- Quiz
- ChooseKindOfQuestion
- AskQuestion of/GiveQuestion to a student
- Question
- Create/Construct question type
- AskQuestion
- Get CorrectAnswer
- Implementing and Using Classes
- Iterative Enhancement
- Using Stubs
- Sometimes partial function
- Sometimes announce only
- Sometimes totally empty
teststudent.cpp
question.h
- Other Practical Issues
- Handling different kinds of questions
- String return type for answer
- string tostring(int)
- string tostring(double)
- Question Class
-
mathquest.h
-
mathquest.cpp
- Initializer Lists - Syntax
- ClassName::ClassName()
- :
- myVar1(argument),
- myVar2(argument),
- ...
- myVarN(argument)
- {// begin constructor body ...
- Quiz Program
- Includes Student and Quiz Classes
-
quiz.cpp
- Going for Class