CD - title : String - artist : String - length : int - publisher : Publisher CDTest use 1..1 3..* + main(args : String[ ]) + CD() + CD(title : String, artist : String, lenth : int, publisher : Publisher) + setLength(length : int) + setTitle(title : String) + setArtist(artist : String) + setPublisher(publisher : Publisher) + setPublisher(name : String, phone : String) + getLength() : int + getTitle() : String + getArtist() : String + getPublisher() : Publisher + print() + toString() : String Publisher Has 1..1 0..*

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Java Question

 

Overview
The task in this part is also to create a class and a number of objects / instances of this class. To be able to do this, we also need a test class.
The purpose of the task is to, in addition to getting acquainted with the concepts of object, class, constructor and overlay, learn to use other classes in a class. You should also know how we use the Integer class to convert strings to integers.
Task
You must create a class that represents a CD. The class should be named CD and saved in a source file called CD.java. The class must contain data about the CD's title, artist, length (in number of seconds) and which publisher the disc is published on.
Methods must be available for setting and retrieving data for all instance variables, as well as for printing all information about the disk. The setPublisher method should be superimposed so that a variant takes an object of the type Publisher as an argument. The second variant should take two strings as arguments, which are the publisher's name and telephone number.
The print method must print all data about the object as well as the publisher on which the disc is published. Only the publisher's name should be printed. The toString method should return a string representation of the CD object (optionally any information)
to be returned, but e.g. artist and title may be appropriate).
The class diagram below (UML) gives you an idea of ​​what the class is supposed to look like (what instance variables and methods there should be).
You must write a test class that creates at least three CD objects that appropriately demonstrate all the methods in the CD class. Call the class CDTest and save it in the source file CDTest.java. At least one of the objects must be created by asking the user for data. Choose yourself if you want to use the Scanner class or if you use dialog boxes. You can "hardcode" other objects.
Requirement
In order for the information to be considered approved, in addition to the above-mentioned details, it is also required that the requirements that follow are met.
• No public instance variables may be in any class, only methods and constructors may be public.
• All screen prints should be well-structured and easy to understand.
Comment on the source code and describe what is happening.
 In addition, you should generate documentation for Publisher and CD using the javadoc tool.

CD
- title : String
- artist : String
- length : int
- publisher : Publisher
CDTest
use
1..1
3..*
+ main(args : String[ ])
+ CD()
+ CD(title : String, artist : String, lenth : int,
publisher : Publisher)
+ setLength(length : int)
+ setTitle(title : String)
+ setArtist(artist : String)
+ setPublisher(publisher : Publisher)
+ setPublisher(name : String, phone : String)
+ getLength() : int
+ getTitle() : String
+ getArtist() : String
+ getPublisher() : Publisher
+ print()
+ toString() : String
Publisher
Has
1..1
0..*
A
Transcribed Image Text:CD - title : String - artist : String - length : int - publisher : Publisher CDTest use 1..1 3..* + main(args : String[ ]) + CD() + CD(title : String, artist : String, lenth : int, publisher : Publisher) + setLength(length : int) + setTitle(title : String) + setArtist(artist : String) + setPublisher(publisher : Publisher) + setPublisher(name : String, phone : String) + getLength() : int + getTitle() : String + getArtist() : String + getPublisher() : Publisher + print() + toString() : String Publisher Has 1..1 0..* A
Expert Solution
steps

Step by step

Solved in 6 steps with 5 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY