Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This project currently has a class called LeaderBoard that keeps track of the person that's scored the most points in some event. Your task is

This project currently has a class called LeaderBoard that keeps track of the person that's scored the most points in some event. Your task is to make a subclass of LeaderBoard called RegionLeaderBoard. This subclass will keep track of which world region has the most entries in the leader board. Make RegionLeaderBoard have

1. A method called addScore that accepts three parameters: Name, score, and region. Make counter variables to keep track of which region is on the leader board the most. This method will call the super class' version of addScore.

2. A method called getNorthAmericaCount, which returns the number of times that addScorewas called with NorthAmerica as the region

3. A method called getAsiaCount, which does the same thing but for the Asia region.

4. A method called getEuropeCount, which does the same thing but for the Europe region.

here are the other files to know about in order for the RegionLeaderBoard to work. image text in transcribed

The required ouput is:

Leaderboard Region Counts

North America: 1

Asia: 0

Europe: 0

Leaderboard Region Counts

North America: 1

Asia: 0

Europe: 3

Leaderboard Region Counts

North America: 1

Asia: 2

Europe: 3

Leaderboard Region Counts

North America: 1

Asia: 4

Europe: 3

Leaderboard Region Counts

North America: 2

Asia: 4

Europe: 3

Leaderboard Region Counts

North America: 3

Asia: 4

Europe: 3

Leaderboard Region Counts

North America: 4

Asia: 4

Europe: 3

Leaderboard Region Counts

North America: 5

Asia: 4

Europe: 3

LeaderBoardDemo1.java X Region.java x 2public class LeaderBoardDemol public static void test (RegionLeaderBoard b) public class LeaderBoard public enum Region System.out.println("Leaderboard Region Counts"); Systen.out.println"North America: " + b.getNorthAmericaCount)); System.out.println("Asia: "b.getAsiaCount O); System.out.println("Europe: b.getEuropeCount)) private String top_username; private int top score 0; NorthAmerica Europe, Asia public boolean addScore(String username, int score 7 10 if (score > top score) public static void main(String[l args) 12 13 14 15 16 17 10 top-score = score; top_usernameusername; return true; RegionLeaderBoard bnew RegionLeaderBoard); 12 13 14 b.addScore name: "Ron Gilbert", score: 15000, Region.NorthAmeric test(b) return false; 16 17 b.addScore name: "David Jones, score: 15000, Region.Europe); b.addScore( name: "Notch, score: 100, Region.Europe) b.addScoref name: "Jaakko Iisalo, score: 100, Region.Europe); test b): 19 public String getTopPlayer) 21 19 return top_username; 23 24 21 b.addScore( name: "Satoru Iwata", score: 15000, Region.Asia); b.addScoref name: "Hironobu Sakaguchi", score: 14000, Region.Asia); test b): public int getTopScore) 23 24 25 26 return top score; 2B 29 b.addScore( name: "Shigeru Miyamoto", score: 1000, Region.Asia); b.addScoref name: "Shigeru Miyamoto", sc: 16000, Region.Asia); test b): 28 31 b.addScore( name: "Sid Meier", score: 50, Region.NorthAmerica) test (b); b.addScore name: "Will Wright, score: 50000, Region.NorthAmerica) test(b); b.addScore name: "Brad McQuaid, score: 2000, Region. NorthAmerica); test(b); b.addScore name: "Gabe Newell, score: 200, Region.NorthAmerica); test(b); 35 38 39 43

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

More Books

Students also viewed these Databases questions