Quiz 4 Fall 2003 - Software Development Methods | CS 314, Quizzes of Computer Science

Material Type: Quiz; Class: Software Development Methods; Subject: Computer Science; University: Colorado State University; Term: Spring 2003;

Typology: Quizzes

2011/2012

Uploaded on 04/16/2012

koofers-user-1ky-1
koofers-user-1ky-1 🇺🇸

10 documents

1 / 5

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
pf3
pf4
pf5

Partial preview of the text

Download Quiz 4 Fall 2003 - Software Development Methods | CS 314 and more Quizzes Computer Science in PDF only on Docsity!

C5314: Software Development Methods Name: Quiz 5, 04/04/03, 5 points 1. The following example is from Martin Fowler’s book “Refactoring: Improving the design of existing code.” We have provided code from a program that caiculates and prints statements of a customer’s charges at a video store. The program is told which movies a customer rented, and for how long. The program then calculates the charges that depend on how long the movie is rented, and the type of the movie. There are three kinds of movies: regular, children’s and new releases. In addition to calculating the charges, the program also computes frequent renter points, which vary depending on whether the film is anew release. Movie class Rental class Customer class Public class Movie { public static final int CHILDRENS = 2; public static final int REGULAR = 0; public static final int NEW_RELEASE= 1; private String _title; private int _priceCode; public Movie(String title,int priceCode){ _title = title; _PriceCode = priceCode; j H Code for int getPriceCode() 11 Code for void setPriceCode(int pc) 1 Code for String getTitle } public class Rental { private Movie _movie; private int _daysRented; public Rental(Movie movie,int daysRented){ _movie = movie; _daysRented = daysRented; } public int getDaysRented() { return _daysRented; } public Movie getMovie() { Tetum _movie; } public class Customer { private String name; private Vector _rentals = new Vector(); public Customer (String name) { _name = name; } public void addRental(Rental arg) { _rentals.addElement(arg); } public String getName() { retum name; } #f Code for String statement() 1 a. Based on the above three classes draw a UML Class Diagram that shows the classes, class names, attributes, types, methods and their signatures, and associations and their multiplicities.