LAB Final: CMPS242: Exercise 1
LAB Final: CMPS242: Exercise 1
Exercise 1:
Video VideoStore
Title: String videoCount:int
checkedOut: Boolean:false capacity: int
averageRating: double catalogue: Video[]
ratingSum: int addVideo(String title):void
ratingCount: int checkOutVideo(int video):void
addRating(int rate):void returnVideo(int video):void
getRating():double rateVideo(int video, int
checkOut():void rating):void
returnToStore():void ratingForVideo(int video):double
isCheckedOut():Boolean getVideoByTitle(String title): int
getVideoByIndex(int index): String
extendCatalogue()
1. Implement class Video:
Methods:
Page | 1
2. Implement class VideoStore:
Attributes:
VideoCount, counts the number of videos.
Capacity initially set to four that is the maximum number of videos in
the video store.
Define the array of objects catalogue that has initially a capacity of
four videos.
Methods:
Page | 2
Add 5 videos to it.
Set a rating for each video.
Test all the implemented methods for both classes.
Exercise 2:
Write a Java program that implements the classes in the following UML.
2. Write the implementation class Circle, with a protected variable radius, which
implements the interface GeometricObject.
3. Write a test program called TestCircle to test the methods defined in Circle.
Page | 4