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 report of about 900 words that- identifies at least

write a report of about 900 words that- identifies at least 3 users of hr services internal to your organisation and

  Write the application using the one-dimensional array

Write the application using the one-dimensional array which inputs ten numbers from user, each number can be between and 100, inclusive.

  List the assembly language program

List the assembly language program (of the equivalent binary instructions), generated by a compiler from the following pseudo-code program. Assume all variables are integer.

  Write the function day

Write the function day(d, m) where m is an integer from 1 through 12 expressing a month, and d is an integer from 1 through 31 expressing the day part of a date in 2014. The function should return the day name ('Mo', 'Su'.etc)

  Write function which takes a string as the argument

Some examples are: "1234321", "C", "ABCBA". Write down a function which takes a string as the argument and returns 1 if string is palindrome and 0 otherwise.

  How does it differ from the implementation of the class?

what is the public interface of the counter class in section instance variables and encapsulation?

  Write pseudocode statements to declare four integers

Write Pseudocode statements to Declare 4 Integers. You can decide on the variables names of each of the integers.

  Create a file values.txt contains the data

Make sure your program is clear with no syntactical errors, correctly uses i/o syntax, correctly uses branching and looping syntax, that it contains functions with correct parameters and return values, that it correctly uses arrays, and that you p..

  Write a function that accepts temperature in degrees

write a function that accepts temperature in degrees fahrenheit degf andcomputes the corresponding value in degrees

  Program calculate average number of days employee are absent

Write a program that calculates the average number of days a company's employees are absent. The program should have the following functions: a function called main that asks the user for the number of employees.

  Pseudocode for linear search by using clrs3e style

Write pseudocode for linear search by using CLRS3e style used in, which scans through the sequence, looking for v.

  Write a program that asks how many tickets sales

Write a program that asks how many tickets sales. Format your dollar amount in a fixed-point notation with two decimal points and make sure the decimal point is always displayed.

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