SlideShare a Scribd company logo
1 of 1
Implement these classes and a interface in 3 Java programs: Class 1: Track(String trackName,
String[] musicians, int durSecs) - The constructor creates a track object. String gettrackName() -
Accessor for the track name String[] getMusicians() - Accessor for the list of musicians int
getDurSecs() - Accessor for the duration of the track Class 2: InfTracklist(String trackName) --
Create a track list with the given name String gettrackName() - Return the name of the track list
int num() -- Return the number of tracks in the track list Track start() - Return the current track,
and then move the current track to the next item in the list (plays current track, then moves to the
next track) void add(Track track) - Add a new track to be the next track The track list works with
an iterator interface called TrackIterator, so that the user can move forward or backwards
through the list without changing the currently playing track. The track list exports these public
methods that use an iterator. TrackIterator iterator() - This returns an instance of a TrackIterator
starting from the current track. void reset(TrackIterator it) - Set playback to start from the track
pointed to by the track iterator void remove(TrackIterator it) - Remove the track pointed to by
the iterator. If the current track is pointed to by the iterator, set it to the next track, or null if there
are no more tracks. TrackIterator: The TrackIterator interface represents an iterator that allows
you to move through the list from the current point. The Zune uses this to allow you to move
through tracks forwards and backwards. The iterator's abstract methods are: Track current() --
Get the current track that the iterator is pointing to void next() - Advance the iteration void
previous() - Move backwards in the iteration Since the iterator is defined as an interface in
TrackIterator.java, you have to provide a concrete implementation of this interface for your
iterator. Provide your own concrete class that implements TrackIterator. Create your iterator
implementation as a (non-public) class inside InfTracklist.java. Call it anything you want.
Stylistically, a lot of people append "Impl" to their classes that implement an interface, so you
could call it TrackIteratorImpl, for example. Casting is the process of converting one type to
another. In the program, the InfTracklist.remove(TrackIterator it) method takes a TrackIterator as
an argument. That's great, except that TrackIterator is an interface. You really need the class that
implements the TrackIterator, which is TrackIteratorImpl. However the argument is of type
TrackIterator. So how do we change a TrackIterator to a TrackIteratorImpl? Inside the remove
function, we can cast it, like this: TrackIteratorImpl itImpl = (TrackIteratorImpl) it Now we have
a itImpl variable that we can use.

More Related Content

Similar to Implement these classes and a interface in 3 Java programs- Class 1- T.docx

9781439035665 ppt ch08
9781439035665 ppt ch089781439035665 ppt ch08
9781439035665 ppt ch08Terry Yoast
 
Linked list (java platform se 8 )
Linked list (java platform se 8 )Linked list (java platform se 8 )
Linked list (java platform se 8 )charan kumar
 
Boost your craftsmanship with Java 8
Boost your craftsmanship with Java 8Boost your craftsmanship with Java 8
Boost your craftsmanship with Java 8João Nunes
 
Java8: what's new and what's hot
Java8: what's new and what's hotJava8: what's new and what's hot
Java8: what's new and what's hotSergii Maliarov
 
documents.pub_new-features-in-java-8-it-jpoialjavanaitedwien15java8pdf-java-8...
documents.pub_new-features-in-java-8-it-jpoialjavanaitedwien15java8pdf-java-8...documents.pub_new-features-in-java-8-it-jpoialjavanaitedwien15java8pdf-java-8...
documents.pub_new-features-in-java-8-it-jpoialjavanaitedwien15java8pdf-java-8...Akaks
 
Apache Flink Training: DataStream API Part 2 Advanced
Apache Flink Training: DataStream API Part 2 Advanced Apache Flink Training: DataStream API Part 2 Advanced
Apache Flink Training: DataStream API Part 2 Advanced Flink Forward
 
Functions in advanced programming
Functions in advanced programmingFunctions in advanced programming
Functions in advanced programmingVisnuDharsini
 
Concurrent talk
Concurrent talkConcurrent talk
Concurrent talkrahulrevo
 
The implementation for Mergesort given in Section 7.4 takes an array .pdf
The implementation for Mergesort given in Section 7.4 takes an array .pdfThe implementation for Mergesort given in Section 7.4 takes an array .pdf
The implementation for Mergesort given in Section 7.4 takes an array .pdfbirajdar2
 
RxJava2 Slides
RxJava2 SlidesRxJava2 Slides
RxJava2 SlidesYarikS
 
Array list (java platform se 8 )
Array list (java platform se 8 )Array list (java platform se 8 )
Array list (java platform se 8 )charan kumar
 
819 LAB Program Playlist c++ You will be building a li.pdf
819 LAB Program Playlist c++ You will be building a li.pdf819 LAB Program Playlist c++ You will be building a li.pdf
819 LAB Program Playlist c++ You will be building a li.pdfmeenaaarika
 
File Input and output.pptx
File Input  and output.pptxFile Input  and output.pptx
File Input and output.pptxcherryreddygannu
 
Psycopg2 postgres python DDL Operaytions (select , Insert , update, create ta...
Psycopg2 postgres python DDL Operaytions (select , Insert , update, create ta...Psycopg2 postgres python DDL Operaytions (select , Insert , update, create ta...
Psycopg2 postgres python DDL Operaytions (select , Insert , update, create ta...sachin kumar
 

Similar to Implement these classes and a interface in 3 Java programs- Class 1- T.docx (20)

9781439035665 ppt ch08
9781439035665 ppt ch089781439035665 ppt ch08
9781439035665 ppt ch08
 
Basic data-structures-v.1.1
Basic data-structures-v.1.1Basic data-structures-v.1.1
Basic data-structures-v.1.1
 
unit-3java.pptx
unit-3java.pptxunit-3java.pptx
unit-3java.pptx
 
Linked list (java platform se 8 )
Linked list (java platform se 8 )Linked list (java platform se 8 )
Linked list (java platform se 8 )
 
Boost your craftsmanship with Java 8
Boost your craftsmanship with Java 8Boost your craftsmanship with Java 8
Boost your craftsmanship with Java 8
 
Lambda Functions in Java 8
Lambda Functions in Java 8Lambda Functions in Java 8
Lambda Functions in Java 8
 
Chap08
Chap08Chap08
Chap08
 
Java8: what's new and what's hot
Java8: what's new and what's hotJava8: what's new and what's hot
Java8: what's new and what's hot
 
documents.pub_new-features-in-java-8-it-jpoialjavanaitedwien15java8pdf-java-8...
documents.pub_new-features-in-java-8-it-jpoialjavanaitedwien15java8pdf-java-8...documents.pub_new-features-in-java-8-it-jpoialjavanaitedwien15java8pdf-java-8...
documents.pub_new-features-in-java-8-it-jpoialjavanaitedwien15java8pdf-java-8...
 
Java 8 Feature Preview
Java 8 Feature PreviewJava 8 Feature Preview
Java 8 Feature Preview
 
Apache Flink Training: DataStream API Part 2 Advanced
Apache Flink Training: DataStream API Part 2 Advanced Apache Flink Training: DataStream API Part 2 Advanced
Apache Flink Training: DataStream API Part 2 Advanced
 
Functions in advanced programming
Functions in advanced programmingFunctions in advanced programming
Functions in advanced programming
 
Concurrent talk
Concurrent talkConcurrent talk
Concurrent talk
 
The implementation for Mergesort given in Section 7.4 takes an array .pdf
The implementation for Mergesort given in Section 7.4 takes an array .pdfThe implementation for Mergesort given in Section 7.4 takes an array .pdf
The implementation for Mergesort given in Section 7.4 takes an array .pdf
 
RxJava2 Slides
RxJava2 SlidesRxJava2 Slides
RxJava2 Slides
 
Array list (java platform se 8 )
Array list (java platform se 8 )Array list (java platform se 8 )
Array list (java platform se 8 )
 
819 LAB Program Playlist c++ You will be building a li.pdf
819 LAB Program Playlist c++ You will be building a li.pdf819 LAB Program Playlist c++ You will be building a li.pdf
819 LAB Program Playlist c++ You will be building a li.pdf
 
File Input and output.pptx
File Input  and output.pptxFile Input  and output.pptx
File Input and output.pptx
 
Psycopg2 postgres python DDL Operaytions (select , Insert , update, create ta...
Psycopg2 postgres python DDL Operaytions (select , Insert , update, create ta...Psycopg2 postgres python DDL Operaytions (select , Insert , update, create ta...
Psycopg2 postgres python DDL Operaytions (select , Insert , update, create ta...
 
Files streams..
Files streams..Files streams..
Files streams..
 

More from Blake0FxCampbelld

In C pls -- Write your name here -- Write the compiler used- Visual st.docx
In C pls -- Write your name here -- Write the compiler used- Visual st.docxIn C pls -- Write your name here -- Write the compiler used- Visual st.docx
In C pls -- Write your name here -- Write the compiler used- Visual st.docxBlake0FxCampbelld
 
In Arevalo- Aravind- Ayuso and Roca's (2013) article- we learn that th.docx
In Arevalo- Aravind- Ayuso and Roca's (2013) article- we learn that th.docxIn Arevalo- Aravind- Ayuso and Roca's (2013) article- we learn that th.docx
In Arevalo- Aravind- Ayuso and Roca's (2013) article- we learn that th.docxBlake0FxCampbelld
 
In a Word document- you will need to list and define all key terms wit.docx
In a Word document- you will need to list and define all key terms wit.docxIn a Word document- you will need to list and define all key terms wit.docx
In a Word document- you will need to list and define all key terms wit.docxBlake0FxCampbelld
 
In a survey of 2918 adults- 1477 say they have started paying bills on.docx
In a survey of 2918 adults- 1477 say they have started paying bills on.docxIn a survey of 2918 adults- 1477 say they have started paying bills on.docx
In a survey of 2918 adults- 1477 say they have started paying bills on.docxBlake0FxCampbelld
 
In a population of yellow mushrooms- a mutation resulted in a new purp (1).docx
In a population of yellow mushrooms- a mutation resulted in a new purp (1).docxIn a population of yellow mushrooms- a mutation resulted in a new purp (1).docx
In a population of yellow mushrooms- a mutation resulted in a new purp (1).docxBlake0FxCampbelld
 
In a particular hospital- 5 newborn babies were delivered yesterday- H.docx
In a particular hospital- 5 newborn babies were delivered yesterday- H.docxIn a particular hospital- 5 newborn babies were delivered yesterday- H.docx
In a particular hospital- 5 newborn babies were delivered yesterday- H.docxBlake0FxCampbelld
 
In a paper written by Bendey Coliege econonists Patricia M- Flynn and.docx
In a paper written by Bendey Coliege econonists Patricia M- Flynn and.docxIn a paper written by Bendey Coliege econonists Patricia M- Flynn and.docx
In a paper written by Bendey Coliege econonists Patricia M- Flynn and.docxBlake0FxCampbelld
 
In a given population of Drosophila- curly wings (c) is recessive to t.docx
In a given population of Drosophila- curly wings (c) is recessive to t.docxIn a given population of Drosophila- curly wings (c) is recessive to t.docx
In a given population of Drosophila- curly wings (c) is recessive to t.docxBlake0FxCampbelld
 
In a large population- 51- of the people have been vaccinated- If 4 pe.docx
In a large population- 51- of the people have been vaccinated- If 4 pe.docxIn a large population- 51- of the people have been vaccinated- If 4 pe.docx
In a large population- 51- of the people have been vaccinated- If 4 pe.docxBlake0FxCampbelld
 
In a geographic isolate- a small population has been studied for a gen.docx
In a geographic isolate- a small population has been studied for a gen.docxIn a geographic isolate- a small population has been studied for a gen.docx
In a geographic isolate- a small population has been studied for a gen.docxBlake0FxCampbelld
 
In a democracy- politicians may be shortsighted because they want to w.docx
In a democracy- politicians may be shortsighted because they want to w.docxIn a democracy- politicians may be shortsighted because they want to w.docx
In a democracy- politicians may be shortsighted because they want to w.docxBlake0FxCampbelld
 
In a certain city- the daily consumption of water (in millions of lite.docx
In a certain city- the daily consumption of water (in millions of lite.docxIn a certain city- the daily consumption of water (in millions of lite.docx
In a certain city- the daily consumption of water (in millions of lite.docxBlake0FxCampbelld
 
In a certain geographic location 15- of individuals have disease A- 15.docx
In a certain geographic location 15- of individuals have disease A- 15.docxIn a certain geographic location 15- of individuals have disease A- 15.docx
In a certain geographic location 15- of individuals have disease A- 15.docxBlake0FxCampbelld
 
In 2014- the General Social Survey incuded a question about the role o.docx
In 2014- the General Social Survey incuded a question about the role o.docxIn 2014- the General Social Survey incuded a question about the role o.docx
In 2014- the General Social Survey incuded a question about the role o.docxBlake0FxCampbelld
 
In 1993- when Fischer began his tenure at Kodak- the film industry was.docx
In 1993- when Fischer began his tenure at Kodak- the film industry was.docxIn 1993- when Fischer began his tenure at Kodak- the film industry was.docx
In 1993- when Fischer began his tenure at Kodak- the film industry was.docxBlake0FxCampbelld
 
In search engines analyzes the sequences of search queries to identif.docx
In  search engines analyzes the sequences of search queries to identif.docxIn  search engines analyzes the sequences of search queries to identif.docx
In search engines analyzes the sequences of search queries to identif.docxBlake0FxCampbelld
 
import os import matplotlib-pyplot as plt import pandas as pd import r.docx
import os import matplotlib-pyplot as plt import pandas as pd import r.docximport os import matplotlib-pyplot as plt import pandas as pd import r.docx
import os import matplotlib-pyplot as plt import pandas as pd import r.docxBlake0FxCampbelld
 
import java-util--- import java-io--- class Vertex { -- Constructo.docx
import java-util--- import java-io---   class Vertex {   -- Constructo.docximport java-util--- import java-io---   class Vertex {   -- Constructo.docx
import java-util--- import java-io--- class Vertex { -- Constructo.docxBlake0FxCampbelld
 
Implement the Plates class buildMap function so that it populates the.docx
Implement the Plates class buildMap function so that it populates the.docxImplement the Plates class buildMap function so that it populates the.docx
Implement the Plates class buildMap function so that it populates the.docxBlake0FxCampbelld
 
Implementing AES- Native Instructions (AES-NI) is faster than other im.docx
Implementing AES- Native Instructions (AES-NI) is faster than other im.docxImplementing AES- Native Instructions (AES-NI) is faster than other im.docx
Implementing AES- Native Instructions (AES-NI) is faster than other im.docxBlake0FxCampbelld
 

More from Blake0FxCampbelld (20)

In C pls -- Write your name here -- Write the compiler used- Visual st.docx
In C pls -- Write your name here -- Write the compiler used- Visual st.docxIn C pls -- Write your name here -- Write the compiler used- Visual st.docx
In C pls -- Write your name here -- Write the compiler used- Visual st.docx
 
In Arevalo- Aravind- Ayuso and Roca's (2013) article- we learn that th.docx
In Arevalo- Aravind- Ayuso and Roca's (2013) article- we learn that th.docxIn Arevalo- Aravind- Ayuso and Roca's (2013) article- we learn that th.docx
In Arevalo- Aravind- Ayuso and Roca's (2013) article- we learn that th.docx
 
In a Word document- you will need to list and define all key terms wit.docx
In a Word document- you will need to list and define all key terms wit.docxIn a Word document- you will need to list and define all key terms wit.docx
In a Word document- you will need to list and define all key terms wit.docx
 
In a survey of 2918 adults- 1477 say they have started paying bills on.docx
In a survey of 2918 adults- 1477 say they have started paying bills on.docxIn a survey of 2918 adults- 1477 say they have started paying bills on.docx
In a survey of 2918 adults- 1477 say they have started paying bills on.docx
 
In a population of yellow mushrooms- a mutation resulted in a new purp (1).docx
In a population of yellow mushrooms- a mutation resulted in a new purp (1).docxIn a population of yellow mushrooms- a mutation resulted in a new purp (1).docx
In a population of yellow mushrooms- a mutation resulted in a new purp (1).docx
 
In a particular hospital- 5 newborn babies were delivered yesterday- H.docx
In a particular hospital- 5 newborn babies were delivered yesterday- H.docxIn a particular hospital- 5 newborn babies were delivered yesterday- H.docx
In a particular hospital- 5 newborn babies were delivered yesterday- H.docx
 
In a paper written by Bendey Coliege econonists Patricia M- Flynn and.docx
In a paper written by Bendey Coliege econonists Patricia M- Flynn and.docxIn a paper written by Bendey Coliege econonists Patricia M- Flynn and.docx
In a paper written by Bendey Coliege econonists Patricia M- Flynn and.docx
 
In a given population of Drosophila- curly wings (c) is recessive to t.docx
In a given population of Drosophila- curly wings (c) is recessive to t.docxIn a given population of Drosophila- curly wings (c) is recessive to t.docx
In a given population of Drosophila- curly wings (c) is recessive to t.docx
 
In a large population- 51- of the people have been vaccinated- If 4 pe.docx
In a large population- 51- of the people have been vaccinated- If 4 pe.docxIn a large population- 51- of the people have been vaccinated- If 4 pe.docx
In a large population- 51- of the people have been vaccinated- If 4 pe.docx
 
In a geographic isolate- a small population has been studied for a gen.docx
In a geographic isolate- a small population has been studied for a gen.docxIn a geographic isolate- a small population has been studied for a gen.docx
In a geographic isolate- a small population has been studied for a gen.docx
 
In a democracy- politicians may be shortsighted because they want to w.docx
In a democracy- politicians may be shortsighted because they want to w.docxIn a democracy- politicians may be shortsighted because they want to w.docx
In a democracy- politicians may be shortsighted because they want to w.docx
 
In a certain city- the daily consumption of water (in millions of lite.docx
In a certain city- the daily consumption of water (in millions of lite.docxIn a certain city- the daily consumption of water (in millions of lite.docx
In a certain city- the daily consumption of water (in millions of lite.docx
 
In a certain geographic location 15- of individuals have disease A- 15.docx
In a certain geographic location 15- of individuals have disease A- 15.docxIn a certain geographic location 15- of individuals have disease A- 15.docx
In a certain geographic location 15- of individuals have disease A- 15.docx
 
In 2014- the General Social Survey incuded a question about the role o.docx
In 2014- the General Social Survey incuded a question about the role o.docxIn 2014- the General Social Survey incuded a question about the role o.docx
In 2014- the General Social Survey incuded a question about the role o.docx
 
In 1993- when Fischer began his tenure at Kodak- the film industry was.docx
In 1993- when Fischer began his tenure at Kodak- the film industry was.docxIn 1993- when Fischer began his tenure at Kodak- the film industry was.docx
In 1993- when Fischer began his tenure at Kodak- the film industry was.docx
 
In search engines analyzes the sequences of search queries to identif.docx
In  search engines analyzes the sequences of search queries to identif.docxIn  search engines analyzes the sequences of search queries to identif.docx
In search engines analyzes the sequences of search queries to identif.docx
 
import os import matplotlib-pyplot as plt import pandas as pd import r.docx
import os import matplotlib-pyplot as plt import pandas as pd import r.docximport os import matplotlib-pyplot as plt import pandas as pd import r.docx
import os import matplotlib-pyplot as plt import pandas as pd import r.docx
 
import java-util--- import java-io--- class Vertex { -- Constructo.docx
import java-util--- import java-io---   class Vertex {   -- Constructo.docximport java-util--- import java-io---   class Vertex {   -- Constructo.docx
import java-util--- import java-io--- class Vertex { -- Constructo.docx
 
Implement the Plates class buildMap function so that it populates the.docx
Implement the Plates class buildMap function so that it populates the.docxImplement the Plates class buildMap function so that it populates the.docx
Implement the Plates class buildMap function so that it populates the.docx
 
Implementing AES- Native Instructions (AES-NI) is faster than other im.docx
Implementing AES- Native Instructions (AES-NI) is faster than other im.docxImplementing AES- Native Instructions (AES-NI) is faster than other im.docx
Implementing AES- Native Instructions (AES-NI) is faster than other im.docx
 

Recently uploaded

HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxmarlenawright1
 
Michaelis Menten Equation and Estimation Of Vmax and Tmax.pptx
Michaelis Menten Equation and Estimation Of Vmax and Tmax.pptxMichaelis Menten Equation and Estimation Of Vmax and Tmax.pptx
Michaelis Menten Equation and Estimation Of Vmax and Tmax.pptxRugvedSathawane
 
diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....Ritu480198
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17Celine George
 
Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111GangaMaiya1
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jisc
 
Ernest Hemingway's For Whom the Bell Tolls
Ernest Hemingway's For Whom the Bell TollsErnest Hemingway's For Whom the Bell Tolls
Ernest Hemingway's For Whom the Bell TollsPallavi Parmar
 
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaEADTU
 
PANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptxPANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptxakanksha16arora
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...Amil baba
 
Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17Celine George
 
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...Gary Wood
 
How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17Celine George
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfPondicherry University
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxJisc
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSAnaAcapella
 
Play hard learn harder: The Serious Business of Play
Play hard learn harder:  The Serious Business of PlayPlay hard learn harder:  The Serious Business of Play
Play hard learn harder: The Serious Business of PlayPooky Knightsmith
 
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsNbelano25
 
Introduction to TechSoup’s Digital Marketing Services and Use Cases
Introduction to TechSoup’s Digital Marketing  Services and Use CasesIntroduction to TechSoup’s Digital Marketing  Services and Use Cases
Introduction to TechSoup’s Digital Marketing Services and Use CasesTechSoup
 

Recently uploaded (20)

HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Michaelis Menten Equation and Estimation Of Vmax and Tmax.pptx
Michaelis Menten Equation and Estimation Of Vmax and Tmax.pptxMichaelis Menten Equation and Estimation Of Vmax and Tmax.pptx
Michaelis Menten Equation and Estimation Of Vmax and Tmax.pptx
 
diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
Including Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdfIncluding Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdf
 
Ernest Hemingway's For Whom the Bell Tolls
Ernest Hemingway's For Whom the Bell TollsErnest Hemingway's For Whom the Bell Tolls
Ernest Hemingway's For Whom the Bell Tolls
 
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
 
PANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptxPANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptx
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17
 
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
 
How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
 
Play hard learn harder: The Serious Business of Play
Play hard learn harder:  The Serious Business of PlayPlay hard learn harder:  The Serious Business of Play
Play hard learn harder: The Serious Business of Play
 
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf arts
 
Introduction to TechSoup’s Digital Marketing Services and Use Cases
Introduction to TechSoup’s Digital Marketing  Services and Use CasesIntroduction to TechSoup’s Digital Marketing  Services and Use Cases
Introduction to TechSoup’s Digital Marketing Services and Use Cases
 

Implement these classes and a interface in 3 Java programs- Class 1- T.docx

  • 1. Implement these classes and a interface in 3 Java programs: Class 1: Track(String trackName, String[] musicians, int durSecs) - The constructor creates a track object. String gettrackName() - Accessor for the track name String[] getMusicians() - Accessor for the list of musicians int getDurSecs() - Accessor for the duration of the track Class 2: InfTracklist(String trackName) -- Create a track list with the given name String gettrackName() - Return the name of the track list int num() -- Return the number of tracks in the track list Track start() - Return the current track, and then move the current track to the next item in the list (plays current track, then moves to the next track) void add(Track track) - Add a new track to be the next track The track list works with an iterator interface called TrackIterator, so that the user can move forward or backwards through the list without changing the currently playing track. The track list exports these public methods that use an iterator. TrackIterator iterator() - This returns an instance of a TrackIterator starting from the current track. void reset(TrackIterator it) - Set playback to start from the track pointed to by the track iterator void remove(TrackIterator it) - Remove the track pointed to by the iterator. If the current track is pointed to by the iterator, set it to the next track, or null if there are no more tracks. TrackIterator: The TrackIterator interface represents an iterator that allows you to move through the list from the current point. The Zune uses this to allow you to move through tracks forwards and backwards. The iterator's abstract methods are: Track current() -- Get the current track that the iterator is pointing to void next() - Advance the iteration void previous() - Move backwards in the iteration Since the iterator is defined as an interface in TrackIterator.java, you have to provide a concrete implementation of this interface for your iterator. Provide your own concrete class that implements TrackIterator. Create your iterator implementation as a (non-public) class inside InfTracklist.java. Call it anything you want. Stylistically, a lot of people append "Impl" to their classes that implement an interface, so you could call it TrackIteratorImpl, for example. Casting is the process of converting one type to another. In the program, the InfTracklist.remove(TrackIterator it) method takes a TrackIterator as an argument. That's great, except that TrackIterator is an interface. You really need the class that implements the TrackIterator, which is TrackIteratorImpl. However the argument is of type TrackIterator. So how do we change a TrackIterator to a TrackIteratorImpl? Inside the remove function, we can cast it, like this: TrackIteratorImpl itImpl = (TrackIteratorImpl) it Now we have a itImpl variable that we can use.