Send Close Add comments: (status displays here)
Got it!  This site uses cookies. You consent to this by clicking on "Got it!" or by continuing to use this website.nbsp; Note: This appears on each machine/browser from which this site is accessed.
Q10: Quiz#10: Modules and classes


1. Q10: Module and class
38: Quiz#10: Modules and classes , Name: ___________________________ Write a small example that has a main code part and a module part that contains a class. Draw a box around the module and the main code and label each as main or module.

The module part should define a class Adder. Use your initials for the prefix of the module name. The module name suffix should be Adder. The constructor should set the integer class sum to zero. The class should contain a method sumAdd which takes one integer and adds that value to the sum. The class should contain a method sumGet which should return the current sum.

The main code should access the module, create an instance of the Adder class and then call that instance to add the integer values from 0 to 8 (inclusive) using the sumAdd method of the Adder class. The main code should then use the sumGet method to get and display the sum using a print statement.

Note: This example can be worked out and tested before the quiz, but you need to remember how to do the various parts from memory for the quiz.

2. Relevant content
Relevant content in the notes includes, but is not limited to, the following.

Some relevant content from the notes includes the following.

Classes: Modules:

3. General comments
Here are some general comments.

4. Post-quiz question and solution

5. Scoring rubric

CS 340 - Q10 : Quiz#10: Modules and classes Your grade: _ / 20    [LATE] Late or redo penalty: _ / -20    main and module names: _ / 2    module definition: _ / 2    class definiton: _ / 6    module access: _ / 2    class creation: _ / 2    main code loop and output: _ / 6    [CREDIT] Extra credit: _ / +4 Comments:


6. End of page