Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

must be in java: Problem 2: We are going to create an array of playlist that hold songs. Create a class named Song. Create 3

must be in java:

Problem 2: We are going to create an array of playlist that hold songs.

Create a class named Song.

Create 3 instance variables, title, artist and length;

Create a constructor which initializes the instance variables. It will have 3 arguments.

Create 3 methods.

Create a getTitle method which should return a title.

Create a getArtist method which should return an artist.

Create a getLength method which should return a length.

Create a call named SongTester.

Import Scanner;

Create a Scanner object.

Create an array of type Song. It should hold 5 songs and be called playlist.

In a loop:

Ask the user to enter the name of the song and assign it to name.

Ask the user to enter the artist of the song and assign it to artist.

Ask the user to enter the length of the song and assign it to length.

Create a Song object using the user input.

Add the object to playlist.

Create a variable named playListLength.

Create a second loop

Get the length of each song in the playlist array

Add the length to playListLength.

Print the length of the playlist using words to describe the output.

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

Database Concepts International Edition

Authors: David M. Kroenke

6th Edition International Edition

0133098222, 978-0133098228

Students also viewed these Databases questions

Question

1. Identify the sources for this conflict.

Answered: 1 week ago

Question

3. The group answers the questions.

Answered: 1 week ago