Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Programming Language Expert

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().

Programming Language, Programming

  • Category:- Programming Language
  • Reference No.:- M91380922
  • Price:- $40

Guranteed 36 Hours Delivery, In Price:- $40

Have any Question?


Related Questions in Programming Language

Task working with arraysoverviewin this task you will

Task: Working with Arrays Overview In this task you will create a simple program which will create and work with an array of strings. This array will then be populated with values, printed out to the console, and then, w ...

Extend the adworks applicationi add dialogs to allow the

Extend the AdWorks application I. Add Dialogs to allow the user to Add, Edit, Read and Delete a Customer and refresh the view accordingly. 1. The user should be able to select a specific customer from the DataGrid and cl ...

Assignment - proposal literature review research method1

Assignment - Proposal, Literature Review, Research Method 1. Abstract - Summary of the knowledge gap: problems of the existing research - Aim of the research, summary of what this project is to achieve - Summary of the a ...

Background informationthis assignment tests your

Background Information This assignment tests your understanding of and ability to apply the programming concepts we have covered throughout the unit. The concepts covered in the second half of the unit build upon the fun ...

Question 1 what is hadoop explaining hadoop 2 what is

Question: 1. What is Hadoop (Explaining Hadoop) ? 2. What is HDFS? 3. What is YARN (Yet Another Resource Negotiator)? The response must be typed, single spaced, must be in times new roman font (size 12) and must follow t ...

1 write a function named check that has three parameters

1. Write a function named check () that has three parameters. The first parameter should accept an integer number, andthe second and third parameters should accept a double-precision number. The function body should just ...

Question - create a microsoft word macro using vba visual

Question - Create a Microsoft Word macro using VBA (Visual Basic for Applications). Name the macro "highlight." The macro should highlight every third line of text in a document. (Imagine creating highlighting that will ...

Task - hand execution of arraysoverviewin this task you

Task - Hand Execution of Arrays Overview In this task you will demonstrate how arrays work by hand executing a number of small code snippets. Instructions Watch the Hand Execution with Arrays video, this shows how to ste ...

Overviewthis tasks provides you an opportunity to get

Overview This tasks provides you an opportunity to get feedback on your Learning Summary Report. The Learning Summary Report outlines how the work you have completed demonstrates that you have met all of the unit's learn ...

Structs and enumsoverviewin this task you will create a

Structs and Enums Overview In this task you will create a knight database to help Camelot keep track of all of their knights. Instructions Lets get started. 1. What the topic 5 videos, these will guide you through buildi ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As