Professional Documents
Culture Documents
Step 1:
Step 2:
Step 3:
Begin by reviewing the objectives listed at the start of each of the PPT lectures. If you do this for all the PPTs (before
you begin this review), you will have a good foundation for the Midterm Review.
Complete the midterm review.
Study the review you have created and practice problems similar to class and homework exercises.
Ex.
1.
software
2.
3.
4.
5.
6.
syntax error
7.
semantic error
8.
compiler
Answer
page 1 of 16
9.
interpreter
10.
11.
pseudocode keywords
12.
flowchart
13.
pseudocode
14.
15.
variable
16.
17.
variable declaration
18.
constant
19.
module
20.
local variable
21.
scope
page 2 of 16
22.
module header
23.
24.
25.
26.
27.
pass by reference
28.
function
29.
library function
30.
function header
31.
32.
object-oriented analysis
33.
UML
34.
object-oriented design
35.
class
36.
object
37.
38.
objects state
39.
method
40.
page 4 of 16
41.
visibility modifier
42.
private access
43.
public access
44.
class diagram
45.
class definition
46.
accessor method
47.
mutator method
48.
application
49.
50.
constructor
51.
default constructor
52.
private access
53.
public access
54.
55.
spaghetti code
56.
57.
58.
assignment operator
59.
60.
operator precedence
61.
page 6 of 16
Application Problems
Create a variable name and data type for each of the following.
Description
62.
number of employees
63.
middle initial
64.
telephone number
65.
Variable Name
Data Type
Create a constant name and data type for each of the following.
66.
minimum wage
67.
68.
page 7 of 16
StudentSupplies
70.
PackingMaterials
Specify an appropriate class name for each of the following lists of objects.
71.
72.
73.
colonial, modern,
craftsman, bungalow,
cottage
milk, cheese, yogurt, butter,
iceCream
Draw a class diagram by hand for a Pet class that stores the species of the pet, the age of the pet, and the name of the pet.
Include the following methods:
i. a default constructor,
ii. another constructor method that has a parameter for each data member (this constructor initializes each attribute
to the value provided when an object of this type is instantiated),
iii. an accessor for each data member,
iv. a mutator for each data member, and
v. a method that prints all the information stored about the pet.
Type the class definition (pseudocode) for the Pet service class. Note: You will be required to draw class diagrams by hand
and type the pseudocode into ANGEL on the Midterm Exam.
page 8 of 16
74.
Start with the class diagram you drew for the previous problem and add an application with a main method that will
instantiate some objects of the Pet class.
Type the class definition (pseudocode) for an application. Create a main method that instantiates an object named mrMax of
the Pet class using the default constructor. Instantiate a second object named msKitty of the Pet class, providing arguments
for each of the parameters in the second constructor.
Include calls to all the Pet class accessor and mutator methods for one of the objects. Also, include a call to the method that
prints all the information about the object.
For each of the following 4 expressions, assume that a, b, and c are Integer variables with the values:
a = 2 b = 9 and c = 10
Specify whether expression will be true or false
75.
a > 5 OR b == 9
76.
77.
78.
page 9 of 16
Another Law:
NOT (j OR k) will always be equivalent to NOT j AND NOT k
(Notice that two things happen:
1. the NOT operator is applied to both j and k
2. the OR operator flips to be an AND operator
Ex4: NOT (w >= z OR y < 3)
Step1Apply DeMorgans Laws
Step2Apply the NOT operators to create positive logic
79.
NOT (x > y)
80.
NOT (z != w)
81.
NOT (x <= 2)
82.
83.
NOT (x == 5 OR y == 5)
page 10 of 16
85.
86.
page 11 of 16
87.
88.
page 12 of 16
89.
90.
91.
92.
If
page 13 of 16
93.
94.
0
.05
.07
.09
95.
discount
discount
0
.05
.07
.09
page 14 of 16
Assume that a class named VIdeo exists and contains attributes for the name of the video and its price. Also assume
that appropriate constructors, accessors, and mutators exist for the Video class.
96.
97.
98.
99.
100.
101.
102.
page 15 of 16
103.
Draw the class diagram by hand and type the pseudocode for this problem.
An Internet music store sells all of its CDs at $10 each. It rewards customers who buy large quantities of CDs using the following
discount table.
Quantity Purchased
10 - 19
20 - 49
50 - 99
100 or more
Discount
20 %
30 %
40 %
50 %
This means that a customer who purchases 2 CDs will pay 2 * 10 or $20.00
A customer who purchases 25 CDs will pay
.70 * (25 * 10) or $ 175.00 (30% discount)
A customer who purchases 80 CDs will pay
.60 * (80 * 10) or $ 480.00 (40% discount)
Draw a class diagram by hand for the following program. Be sure to show the relationship between the components
in the diagram and show multiplicity values. Type the pseudocode for the class and the application.
a. Create a Customer class that contains a customer number, the customers name, and the number of CDs
purchased. For this class:
i. Include a default constructor that initializes each attribute to some reasonable value.
ii. Include another constructor method that has a parameter for each data member. This constructor
initializes each attribute to the value provided when an object of this type is instantiated.
iii. Include accessor and mutator methods for each attribute.
iv. Include a calculatePurchase() method that calculates and displays the cost of the purchase:
b. Add to the class diagram and write the pseudocode for an application program with a main method that
instantiates two objects of the Customer class--one that makes use of the default constructor and one that
provides appropriate values for all the parameters in the constructor.
For one of the objects:
i. Include a call to display the customers number.
ii. Include a call to set the number of CDs purchased to 60
iii. Include a call to calculatePurchase()
page 16 of 16