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

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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