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

  Travelling salesman problem

Travelling Salesman Problem on the L1-metric plane.

  Creating session by granting needed privilege

Make sure that Bob can't create objects greater than 512K in size in USERS01 tablespace. And now that user is created, ensure that Bob can create session, by granting needed privilege.

  Formulae to calculate their center point

Given n points in the 3D space (xo, yo, zo), (x1, y1, z1), (xn-1,yn-1, zn-i), we use the following formulae to calculate their center point (xc, yc, zc)

  Selection tools for the hiring program at supermarket

Write down three selection tools which you would consider using for the hiring program at the supermarket.

  Supporting activity and security personnel

Write a 100- to 200-word short-answer response for the following: Supporting Activity: Security Personnel. Do you think that security personnel require specific skills. Should security practices by an organization be used to prevent the misuse of ..

  Draw a state transition diagram for garage door system

Draw a state transition diagram for garage door system - Design a PLC program using ladder logic that has two input and three outputs.

  Identify all the pure-strategy nash equilibria of game

Identify all of the pure-strategy Nash Equilibria of this game. Identify at least one mixed-strategy Nash Equilibrium, and show that it is a Nash Equilibrium.

  Computing first seven values of fibonacci number sequence

Write a program that uses a loop to compute the first seven values of the Fibonacci number sequence.

  Write an interactive prolog program

Write an interactive Prolog program in which a user enters a positive integer and then displays the power of 2 to that number. For example, if the user enters 4, the program calculates the power 2.

  Implement shape hierarchy-compute area of two-dimensional

Implement Shape hierarchy. Each TwoDimensionalShape must contain function getArea to compute the area of two-dimensional shape. Each ThreeDimensionalShape must have member functions.

  Write program to calculate miles per gallon for automobile

Write down the program which calculates miles per gallon for automobile. The program must ask for beginning milage reading on odometer at first.

  Design logic for application for company to store breakdown

Design the logic for an application for a company that wants a report containing a breakdown of payroll by department. Input includes each employee's last name.

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