Summarizes information about the tune

Assignment Help Programming Languages
Reference no: EM13810969

Assignment - iTunes Objects

An iTunes entry in music library is a descriptor that summarizes information about the tune that it describes. (It is not the actual tune, which is contained in a large music data file.) For each iTunes entry in your own music library file (which is in XML format, but we won't go there) there are between 20 and 50 fields -- i.e., members. If you were to look at the file on your system, you would find that the fields have names like Genre, Track ID, Name, Artist, Bit Rate, Sample Rate, Track Type, and so on.

We will consider a simplified iTunes class, that stores these iTunes entry objects, with only the following four members for each object:

-Name (the title of the song)

-Artist (the performing musician or group)

-Bit Rate (the number of kilobits per second that the iTunes object streams at or plays at -- higher for better quality, lower for smaller data file size)

-Total Time (the playing time of the iTunes object, represented in milliseconds, i.e., 36500 would stand for 36.5 seconds).

The assignment is to first create a class called iTunes that represents these four items, and provides solid protection for the fields. Then, the client, main(), will instantiate between three and six iTunes objects (some using default constructors and some using parameter-taking constructors), display them immediately, mutate many of their fields, and display them again to reflect the changes. Also, test both mutators and accessors, individually in a couple spot-tests of each (two mutator tests and two accessor tests).

The Program Spec

Class iTunes Spec - Private class instance members:

-String name - the title of the song. All legal strings should be between 1 and 80 characters.

-String artist - the performing musician or group. All legal strings should be between 1 and 80 characters.

-int bitrate - the number of kilobits per second. A legal value should be between 64 and 705.

-int totalTime - the playing time in milliseconds. A legal value should be between 1 second and 1 hour (expressed in milliseconds)

As stated in the modules, we never want to see a literal in our methods. So the class should have static members to hold values for the limits described above, as well as default values for any field that is constructed using illegal arguments from the client. These are put in the public static section.

Public class static constants (finals):

-MIN_BITRATE = 64

-MAX_BITRATE = 705

-MIN_STR_LENGTH = 1

-MAX_STR_LENGTH = 80

-MIN_PLAY_TIME = 1000

-MAX_PLAY_TIME = 1000*60*60

-DEFAULT_BITRATE = 64

-DEFAULT_PLAY_TIME = 1000

-DEFAULT_STRING = " (undefined)"

You should supply all of the following public instance methods:

-Constructors -- one that takes no parameters (sets values to default) and one that takes all four parameters.

-Accessors (get()s) and Mutators (set()s) for each instance member.

-String toString() - a method that returns a String which contains all the information of the iTunes object. This String can be in any format as long as it is understandable and clearly formatted. Two of the many possible formats for such a String for oneiTunesobject might be:

"Janiva Magness, You Were Never Mine, 276 seconds, 128k bits per second"

"Title: You Were Never Mine / Artist: Janiva Magness / Playing Time: 4 minutes 36 seconds / Bit Rate: 128k"

-void display() - an output method that sends the String returned by the toString() to the screen. display() can, alternatively, send the data directly to the screen on several lines in a different manner than toString(). It can also call upontoString() but prepend and append extra formatting for the console.

iTunes should be a class distinct from (and not contained within) your main class (which we call Foothill). However, you can and should defined it as a non-public class so it can reside in the same file, Foothill.java.

The Foothill main()

The client has been described, but to summarize, it should instantiate, display, mutate, and display again. It does not have to take any input from the user.

Other Testing

After the main section, confirm that your mutators correctly filter out and report bad arguments to the client by placing a couple mutator calls (not all of them) in if statements which print different messages depending on whether the mutator succeeded or failed. Also, demonstrate at least two different accessor calls to show that they work from main().

Reference no: EM13810969

Questions Cloud

A brief summary of the views of the employees : explain a business situation where there is a business dispute regarding employee compensation. Explain the situation and offer a brief summary of the views of the employees and the views of the management regarding this wage issue.
Health care management : Health care management
What are tqm and iso : How might TQM and ISO be used to improve an organization? What are the benefits and challenges each?
Calculate the work and power : Calculate the work and power for you to climb the flight of stairs Work and Calculate your power in kilowatts
Summarizes information about the tune : An iTunes entry in music library is a descriptor that summarizes information about the tune that it describes. (It is not the actual tune, which is contained in a large music data file.)
The most effective methods of ethics training is an exercise : Those in the field say that one of the most effective methods of ethics training is an exercise in resolving ethical dilemmas that relates to actual situations employees may face on the job
Describe the five phases of a project : Review the Project Management email. Write an email response in which you address the following points:
Process design for production of riordan electric fans : Using the Six Sigma DMAIC process, develop a new process design for the production of the Riordan electric fans. Be sure to take advantage of any global opportunities available to Riordan, such as lower labor costs.
Subcontractors for a government project : Why would subcontractors for a government project want their activities on the critical path? Under what conditions would they try to avoid being on the critical path?

Reviews

Write a Review

Programming Languages Questions & Answers

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

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

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

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