Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Restrictions: Unless directed otherwise, you cannot use any Java class libraries in this assignment. In particular any methods from the Arrays class. If needed cannot

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

Restrictions: Unless directed otherwise, you cannot use any Java class libraries in this assignment. In particular any methods from the Arrays class. If needed cannot use the ArrayList class nor can you use you may create and use one or more instances of an array and access the length instance variable for each array you may use the Java Random class Of course you may use the System.print, println, and printf methods. - - In this project you will be doing the following Develop a java interface named Bag that can store a certain number of whole numbers in it. Abag in java is a kind of collection that does not do much more than contain its items. It does not order the items in any particular order and nor does it prevent duplicates Provide the following methods in the interface. getCurrentsize( that returns a count of numbers in the bag isEmpty)-that checks if the bag is empty, returns true when empty add (int num) - adds the number num to the bag * remove (int num) removes the first occurrence of the number num from the bag emoveremoves a randomly selected entry from the bag clear) removes all the numbers from the bag getFrequencyof (int num) -returns a count the number of times the number num exists in the bag *contains (int num) - Tests whether the bag contains the number num. Returns true when the pum is contained in the bag *tostring( )- returns a String of the contents of the bag equals (object o)returns a true if the parameter o exactly matches the contents of the bag i.e. same numbers in the same order) Design a java class called Scores that implements the Bag interface and provides implementation for all the methods inherited from the Baginterface. Do the following in the Scores class

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 Systems Introduction To Databases And Data Warehouses

Authors: Nenad Jukic, Susan Vrbsky, Svetlozar Nestorov

1st Edition

1943153191, 978-1943153190

More Books

Students also viewed these Databases questions