Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello guys, can anybody help me, i did all of the classes but i'm stuck with the The Test class can you solve it

image text in transcribed

Hello guys, can anybody help me, i did all of the classes but i'm stuck with the " The Test class" can you solve it for me?

this is my code so far,

public class Item { private String title; private boolean hasIt; private String comments; private int playingTime; public Item (){ this.title =""; this.comments= ""; this.playingTime =0; }

public Item(String title, boolean hasIt, String comments, int playingTime) { this.title = title; this.hasIt = hasIt; this.comments = comments; this.playingTime = playingTime; }

public String getTitle() { return title; }

public boolean isHasIt() { return hasIt; }

public String getComments() { return comments; }

public int getPlayingTime() { return playingTime; }

public void setTitle(String title) { this.title = title; }

public void setHasIt(boolean hasIt) { this.hasIt = hasIt; }

public void setComments(String comments) { this.comments = comments; }

public void setPlayingTime(int playingTime) { this.playingTime = playingTime; }

@Override public String toString() { return "Item{" + "title=" + title + ", hasIt=" + hasIt + ", comments=" + comments + ", playingTime=" + playingTime + '}'; } }

public class CD extends Item{ private String artist; private int NumberOfTracks;

public CD(){ super(); this.artist=""; this.NumberOfTracks=0; } public CD(String artist, int NumberOfTracks, String title, boolean hasIt, String comments, int playingTime) { super(title, hasIt, comments, playingTime); this.artist = artist; this.NumberOfTracks = NumberOfTracks; }

public void setArtist(String artist) { this.artist = artist; }

public void setNumberOfTracks(int NumberOfTracks) { this.NumberOfTracks = NumberOfTracks; }

public String getArtist() { return artist; }

public int getNumberOfTracks() { return NumberOfTracks; } }

public class Video extends CD { private String director; public Video (){ super(); director =""; }

public Video(String director, String artist, int NumberOfTracks, String title, boolean hasIt, String comments, int playingTime) { super(artist, NumberOfTracks, title, hasIt, comments, playingTime); this.director = director; }

public String getDirector() { return director; }

public void setDirector(String director) { this.director = director; } }

public class DataBase { ArrayList listOfItem = new ArrayList(); public DataBase(){ } public void add (Item item){ listOfItem.add(item); } public void print (){ for (int i=0; i

thanks,,

The Item Class 1. Write an item class with fields: title, haslt, comments, playing Time. 2. Provide appropriate setter and getters 3. Write a toString method The CD Class 1. Write a CD class with fields: artist, NumberOfTracks 2. Extend the CD class from tem class. 3. Provide appropriate setters and getters The Video Class 1. Write a video class with fields: director 2. Extend the Video class from tem class. 3. Provide appropriate setters and getters. The DataBase Class 1. Write a DataBase that has an array of ite 2. Write method to add an the array mS 3. Write a method to print all the elements of the array The Test Class 1. Can you explain the Polymorphism for the above classes? 2. From the above classes, which class would you use to test all the classes? 3. Now test that by using GUI Forms: You need to provide and implement the following functionalities (1) Add CD information, (2) Add video information (3) Display all the records (CD and Video) stored in the Database (4) Note: Add all necessary methods in any of the above classes

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Expert Oracle Database Architecture

Authors: Thomas Kyte, Darl Kuhn

3rd Edition

1430262990, 9781430262992

More Books

Students also viewed these Databases questions