Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

challenge exercise consider how you might play multiple tracks in random order. would you want to make sure that all tracks are played equally or

challenge exercise consider how you might play multiple tracks in random order. would you want to make sure that all tracks are played equally or prefered favorite tracks? How might a "play count" field in the Track class help wtih this task? This is queston 4.43 in Chapter 4 of Objects First With Java: A Practical Introduction Using BlueJ (5th Edition). I am having trouble solving it and am wondering how I would complete this exercise. Here is the track class:

/** * Store the details of a music track, * such as the artist, title, and file name. * * @author David J. Barnes and Michael Klling * @version 2011.07.31 */ public class Track { // The artist. private String artist; // The track's title. private String title; // Where the track is stored. private String filename; /** * Constructor for objects of class Track. * @param artist The track's artist. * @param title The track's title. * @param filename The track file. */ public Track(String artist, String title, String filename) { setDetails(artist, title, filename); } /** * Constructor for objects of class Track. * It is assumed that the file name cannot be * decoded to extract artist and title details. * @param filename The track file. */ public Track(String filename) { setDetails("unknown", "unknown", filename); } /** * Return the artist. * @return The artist. */ public String getArtist() { return artist; } /** * Return the title. * @return The title. */ public String getTitle() { return title; } /** * Return the file name. * @return The file name. */ public String getFilename() { return filename; } /** * Return details of the track: artist, title and file name. * @return The track's details. */ public String getDetails() { return artist + ": " + title + " (file: " + filename + ")"; } /** * Set details of the track. * @param artist The track's artist. * @param title The track's title. * @param filename The track file. */ private void setDetails(String artist, String title, String filename) { this.artist = artist; this.title = title; this.filename = filename; } }

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_2

Step: 3

blur-text-image_3

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

Automating Access Databases With Macros

Authors: Fish Davis

1st Edition

1797816349, 978-1797816340

More Books

Students also viewed these Databases questions