You are required to perform refactoring on “Movie-Rental” program (program code of the movie, rental and customer class java files) to improve its quality.
You are encouraged to use refactoring services in IDEs such as Eclipse or IntelliJ.

You are required
1) to add a main() method to test the program;
2) to add a new method to print the statement for a customer in XML format, e.g., John Smith , Independent Day , etc.

Please submit your resulting code and a short Word document explaining the rationales behind your refactoring changes.

Your solution must at least contain:
1. At least 3 method extraction operations
(e.g., printing function in the customer class can be extracted to a printing method)
2. At least 3 creation of 3 new classes
(e.g., combine Rental class with Movie class (to remove data class code smell) count as creating one new class).
(e.g., in regarding to the switch statement from line 33-49 in the customer class, creating a module or class for each movie, and put everything in there for that movie, base price, duration, penalty, etc, suddenly you split it to a subclass)
3. At least 3 moving method operations
(e.g., the functionality of the switch statement in the customer class can be moved to the combined rental and movie class)
4. At least 3 renaming operations
(e.g., the method statement() in the customer class could be better renamed according to its functionality)
5. 1-2 replacements of data types
(e.g., such as the constants value in the customer class)

Those operations must be used to removing code smells in the program.
The final program must be running without error.

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

import java.util.Enumeration;
import java.util.Vector;

public class Customer {

    private String _name;
    private Vector _rentals = new Vector();
    public Customer (String name) {
       _name = name;
    public void addRental(MovieRental arg) {
    public String getName() {
       return _name;
    public Enumeration getRentals() {
      return _rentals.elements();
    public String getStatement() {
       Enumeration rentals = this.getRentals();
       String result = "Rental Record for " + getName() + "\n";
       while (rentals.hasMoreElements()) {
            MovieRental each = (MovieRental) rentals.nextElement();
            // s...

By purchasing this solution you'll be able to access the following files:
Solution.docx and

for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Upload a file
Continue without uploading

We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats