Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

5 points Status: Not Submitted In this exercise, you will create a Top 10 Musicians of all time list. A Musician class has been built

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

5 points Status: Not Submitted In this exercise, you will create a Top 10 Musicians of all time list. A Musician class has been built that takes the name, number of albums sold, and number of weeks that artist has been on the Top 40 list. The Musician class also has a boolean instance variable isplatinum that determines if the musician has gone platinum, meaning they've sold over a million copies of the same record. The Billboard class currently has a top1e ArrayList that will store the top 10 musicians as a list. In the Billboard class, create an add method that will add a musician to the list if there are less than 10 musicians in the list, and if the musician has Platinum status. If there are 10 musicians in the list, then the method should call the replace method. Otherwise, a message should be displayed to the user that the musician could not be added to the top10 list. The replace method compares the total number of weeks that the musician has been on the top 40 list. If the musician with the lowest number of weeks on the top 40 is lower than the number of weeks on the top 40 of the new musician, then the old musician is replaced by the new one. There should be a message to the user that the old musician has been replaced by the new one. Otherwise, the user should be notified that the new musician cannot be added because they don't have enough weeks on the top 40. This method should be created in the Billboard class Use the BillboardTester class to test if the new musicians being added are being correctly replaced, or omitted from the Top 10 @ 7.4.8: Billboard Top 10 SAVE SUBMIT + CONTINUE 1 import java.util.ArrayList; 2 public class Billboard 3- { private ArrayList top10 = new ArrayList(); WEBSc vouw //Don't make alterations to this method! public void printTop100) 14 System.out.println(top10); this help with class 7.4.8: Billboard Top 10 SAVE Save SUBMIT + CONTINUE SUBMIT + CONTINUE 1 public class BillboardTester 2 - { public static void main(String[] args) Billboard top10 = new Billboard(); top10.add(new Musician ("Beyonce", 316, 100000000)); top10.add(new Musician ("The Beatles", 365, 600000000)); top10.add(new Musician("Drake", 425, 150000000); top10.add(new Musician("Pink Floyd", 34, 250000000 top10. add new Musician("Mariah Carey", 287, 200000000)); top10.add(new Musician("Rihanna", 688, 250000000)); top10.add(new Musician("Queen", 327, 170000000); top10.add(new Musician("Ed Sheeran", 536, 150000000)); top10.add(new Musician ("Katy Perry", 317, 143000000); top10.add(new Musician("Justin Bieber", 398, 140000000)); //This musician should not be added to the top10 because they don't have enough records sold top1e.add(new Musician("Karel the Dog", 332, 60)); //This musician should replace the artist with the least Weeks on the top 40 charts. top10.add(new Musician("Tracy the Turtle", 332, 150000000)); //This musician should not replace an artist, but is a Platinum artist top10.add(new Musician("Alex Eacker", 100, 23400000); top10.printTop100); 7.4.8: Billboard Top 10 SAVE SUBMIT + CONTINUE 1 public class Musician 2- { private String name; private int weeksInTop40; private int albumsSold; private boolean isplatinum;; public Musician(String name, int weeksInTop40, int albumsSold) this.name = name; this.weeksInTop40 = weeksInTop40; this.albums Sold = albumsSold; setPlatinum(albumsSold); public void setPlatinum(int albums Sold) if(albumsSold >= 1000000) isplatinum = true; else isplatinum = false; public int getWeeksInTop40) return this.weeksInTop40; public String getName() return this.name; public boolean getIsplatinum) return isplatinum; public String toString() return this.name

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions