CECS 277
LAB ASSIGNMENT 4
Assigned date: Wednesday 9/26
Due date: Wed 10/3
65 points
Objectives
Prelab
Problem 1 [ 15 points] -
Discover classes and methods for generating a student report card that lists all classes, grades, and the grade point average for a semester. Produce a set of CRC cards, a UML diagram, and a set of javadoc comments. Implement the code.
Problem 2 - [5 points] Consider the following problem description:
Customers order products from a store. Invoice are generated to list the items and quantities ordered, payment received, and amounts still due. Products are shipped to the shipping address of the customers, and invoices are sent to the billing address.
Draw an UML diagram
Problem 3 - [5 points] - Draw an UML diagram for the Quiz, Questions, and Choice Question classes.
Problem 4 [40 points]
Write a program that simulates a vending machine. Products can be purchased by inserting coins with a value at least equal to the cost of the product. A user select a product from a list of available products, add coins, and either gets the products or gets the coins returned. The coins are returned if insufficient money was supplied or if the product it's sold out. The machine does not give change if too much money was added. Products can be restocked and money remove by an operator. Your solution should include a class VendingMachine that is not coupled with the Scanner or PrintStream classes.
Sample output
S)how products I)nsert coin B)uy A)dd product R)emove coins Q)uit
a
Description:
Cookie
Price:
2.00
Quantity:
3
S)how products I)nsert coin B)uy A)dd product R)emove coins Q)uit
A
Description:
Candy
Price:
1.00
Quantity:
2
S)how products I)nsert coin B)uy A)dd product R)emove coins Q)uit
S
Cookie @ $2.0
Candy @ $1.0
S)how products I)nsert coin B)uy A)dd product R)emove coins Q)uit
b
A) Cookie @ $2.0
B) Candy @ $1.0
a
Insufficient money
S)how products I)nsert coin B)uy A)dd product R)emove coins Q)uit
i
A) nickel @ 0.05
B) dime @ 0.1
C) quarter @ 0.25
D) dollar @ 1.0
d
S)how products I)nsert coin B)uy A)dd product R)emove coins Q)uit
i
A) nickel @ 0.05
B) dime @ 0.1
C) quarter @ 0.25
D) dollar @ 1.0
d
S)how products I)nsert coin B)uy A)dd product R)emove coins Q)uit
b
A) Cookie @ $2.0
B) Candy @ $1.0
a
Purchased: Cookie @ $2.0
S)how products I)nsert coin B)uy A)dd product R)emove coins Q)uit
s
Cookie @ $2.0
Candy @ $1.0
S)how products I)nsert coin B)uy A)dd product R)emove coins Q)uit
b
A) Cookie @ $2.0
B) Candy @ $1.0
b
Insufficient money
S)how products I)nsert coin B)uy A)dd product R)emove coins Q)uit
i
A) nickel @ 0.05
B) dime @ 0.1
C) quarter @ 0.25
D) dollar @ 1.0
d
S)how products I)nsert coin B)uy A)dd product R)emove coins Q)uit
i
A) nickel @ 0.05
B) dime @ 0.1
C) quarter @ 0.25
D) dollar @ 1.0
d
S)how products I)nsert coin B)uy A)dd product R)emove coins Q)uit
i
A) nickel @ 0.05
B) dime @ 0.1
C) quarter @ 0.25
D) dollar @ 1.0
d
S)how products I)nsert coin B)uy A)dd product R)emove coins Q)uit
b
A) Cookie @ $2.0
B) Candy @ $1.0
b
Purchased: Candy @ $1.0
S)how products I)nsert coin B)uy A)dd product R)emove coins Q)uit
r
Removed: $5.0
Grading