Define a superclass to model digital media

Assignment Help JAVA Programming
Reference no: EM132223905

Java Assignment -

Part 1 - DigitalMedia Super Class

Define a superclass to model digital media. Sound, images, text and video are all available in digital format for use on a computer system. The class DigitalMedia is a generalization of these kinds of files. It has two fields: name(String) is the file name that includes the file extension, size(long) is the file size in bytes.

Design the class so that individual instances never contain null fields. The parameterized constructor must validate both parameters before creating the instance.

All classes will be graded using a JUnit test suite, so the method headings for all methods need to match the test class exactly. Refer to the UML diagram to confirm the method headings of your code.

Implement accessor (getter) and mutator (setter) methods for each of the instance variables using the standard naming conventions. In addition, override the following methods from the Object class:

  • public boolean equals(Object other)
  • public String toString()

The equals method parameter must be of type Object. Two DigitalMedia objects are equal if they have the same state as represented by the instance variables. Guidelines for overriding the equals method:

- Use the == operator to check if the argument is a reference to itself.

- Use the instanceof operator to check if the argument has the correct data type- DigitalMedia in this case.

- Cast the argument to the same data type as the class - DigitalMedia in this case.

- For each significant data member, test for equality.

- Test these three properties:

  • Is it symmetric?
  • Is it transitive?
  • Is it consistent?

Your source code file name should be DigitalMedia.java.

Part 2 - Song and Image Subclasses

Write the following Java subclasses of the DigitalMedia class from Part 1: Song to represent a song in a music collection.

In addition to the inherited instance variables from the superclass, there are two additional data members of the Song class. These are String objects representing the artist's name (artist), and the album where the song can be found (album). These instance variables for the class are to have private access modifiers so you will need to write the appropriate methods to allow a client to access and modify the data values.

In accordance with good programming practice, you are to override the equals and toString() methods inherited from the digital media class.

A Song's title is the same as the name instance variable in the super class without the extension.

Two Song objects are considered equal if they have the same title, artist, album, and size.

Image to represent a digital image file.

  • An image has the additional instance variables width and height, both of type int.
  • As for the Song class, implement getters, setters, equals, and toString() for the Image class. Two images are considered equal if they have the same name, size, width, and height

Part 3 - MediaList Class

Implement a class called MediaList that contains a main method that reads in a file name via the command line. The file is a listing of songs and images. In the file, information about each media item is on a single line. For Songs, the line is formatted with the letter s, song file name, the artist name, the album, and size in which each element is separated by a colon (:) and varying amounts of white space. For example,

S : Mykonos.mp3 : Fleet Foxes :Mykonos - Single: 9507904

S : He Doesn't Know Why.mp3 : Fleet Foxes :Fleet Foxes : 7080711

For Images, the line is formatted with the letter i, the image file name, the width, the height, and size in which each element is separated by a colon (:) and varying amounts of white space. For example,

I : Beach.jpg : 2048 : 1536 : 1163207

I : IMG_3658.JPG: 2448 : 3264 : 1384318

The MediaList program is to:

  • Read in the input file creating Song and Image objects from the data contained in the lines of the file.

Failure to create individual Song/Image objects will result in severe point penalties.

  • Store the Songs and Images in a single ArrayList of type DigitalMedia. Using multiple ArrayLists is not permitted.
  • Prompt the user to enter either S or I to see a display of all of the DigitalMedia of that type.
  • If "I" is entered, display a formatted list of all the images by calling the toString() method for each Image object.
  • If "S" is entered, display a formatted list of all the songs by calling the toString() method for each Song object.

Make sure your program is well documented - including the comment block header at the top of all of the source code files with your name, the course number and name, the project name, the program purpose. Be sure to include appropriate comments throughout your code, choose meaningful identifiers, and use indentation as shown in your textbook and in class.

It is expected that your program will be well documented and you are required to include a private helper method in MediaList.java called printHeading that outputs the following information to the console in an easy-to-read format: your name, the project number, the course identifier, and the current semester. You will call this method as the first statement in your main method.

Attachment:- Assignment Files.rar

Reference no: EM132223905

Questions Cloud

Support technological capabilities into the future : You understand better the educational requirements of a country that is necessary to help support technological capabilities into the future.
What are the stages of team development : What are the stages of team development? How can a team leader best facilitate the team at each stage?
Concept of mass marketing and differentiated marketing : Compare and contrast the concept of mass marketing and differentiated marketing.
Respective industry-demonstrate shifts toward horizontal : What are the trends in the respective industry that demonstrate the shifts toward a more horizontal, inclusive, and social business landscape?
Define a superclass to model digital media : Define a superclass to model digital media. Sound, images, text and video are all available in digital format for use on a computer system
Explain briefly why this is marketing-oriented strategy : It seems to call what Mr. Robinson is doing a “sound marketing strategy.” Do you agree? If you do, explain briefly why this is a marketing-oriented strategy.
Company new ethical procurement strategy : Your company’s new ethical procurement strategy which will ensure that you fix the problem long-term.
Does urinary tract infections cause behaviors among elderly : Problem: Behaviors caused by urinary tract Infection in elderly. Does urinary tract infections cause behaviors among the elderly
Have you used ride-hailing service such as uber or lyft : Have you used a ride-hailing service such as Uber or Lyft? How was your experience? Would like to work for Uber? Why or why not?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Implement a set as a new class that is derived

A set is like a bag, except that a set does not allow multiple copies of any element. If you try to insert a new copy of an item that is already present in a set, then the set simply remains unchanged.

  Calculate and return the sum of the geometric series

calculate and return the sum of the geometric series

  Write a java program to calculate the ideal weight

Write a java program to calculate the ideal weight when you enter the age and height of user

  Import the file into eclipse and work on all the tasks

Import the file into eclipse and work on all the tasks in that file and on eclipse - Download the latest version of CuttlefishDinner program

  Write a program that enables elevator-nxtrobot to be control

Write a program that enables theElevator-NXTrobot to be controlled manually using the NXT's front panel buttons (LEFT for door open, RIGHT for door close, ENTER for up, and ESCAPE for down), as demonstrated in thisvideo.

  Create an application using html5

Create an application using HTML5, CSS, and JavaScript that has an image or figure of a trashcan

  Create an unsorted array list with 100 random items in it

Create an unsorted array list with 100 random items in it and then perform a linear search on the array list looking for an item that is present in the list.

  Discuss the effect java applets give to html pages

Instructions: This week please post on each of these two topics: Discuss the role of JavaScript in HTML? Discuss the effect Java Applets give to HTML pages?

  Develop a reservation system program for specific flights.

develop a reservation system program for specific flights. A customer should be able to select from one of four categories of seats on flights from RDU to any of at least three other destinations. Based on the user input of seat type and destination,..

  Combine the four loop problems into one program

Combine the four loop problems into one program with four distinct methods (the data is in the attached document). For this problem you will write methods, two value returning methods and two void methods.

  Write program that convert us dollar into canadian dollar

Design a new class named Polygon that extends GeometricObject and implements Comparable. The number of sides in polygons varies, you cannot use a certain number of data fields for sides of a polygon - Write a program that passes an unspecified numb..

  Write a group chat application using java to illustrate ipc

Write a Group Chat Application using Java to illustrate IPC between multiple Program requirements: Use Connection-oriented (TCP) sockets in Java.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd