Write a random shuffling routine

Assignment Help Computer Engineering
Reference no: EM132084568

Objectives:

To be able to write and implement the ArrayList Data Structure..

Documentation:

1. Explain the purpose of the program as detail as possible

2. Develop a solution for the problem and mention algorithms to be used

3. List data structures to be used in solution.

4. Give a description of how to use the program and expected input/output

5. Explain the purpose of each class you develop in the program.

Programming:

1. For each method, give the pre and post conditions and invariant, if any

2. Program execution according to the requirements given 50%

3. Naming of program as required 5%

Description of Program

You are to write a program name ArrayList.java that creates an ArrayList data structure that is similar to the ArrayList data Structure that exist in the java library. The class must be written to accept any type of Objects. The following must be implemented i.e. YOU must write the code (do not import them from the Java Library):

1.One default constructor that will create an ArrayList object with a default size of 10 ------ public ArrayList();

2.Another constructor that accepts a parameter of type int and sets the size to this parameter ---- public ArrayList(int n);

3.A method that allows you to place a value at the end of the ArrayList ---- public void add(Object x);

4.A method that allows you to place a value at a given location ---- public void add(int index, Object x);

5.A method that allows you to retrieve a value from a given location ---- public Object get(int index);

6.A method that allows you to return the number of elements that is currently in the the ArrayList ----public int size();

7.A method would test to see if the is empty ---- public boolean isEmpty();

8.A method that see if a particular object exist in the --- public boolean isIn(Object ob);

9.A method that will return the location of first occurrence of an Object starting from location 0 ----- public int find (Object n);

10.A method that will remove the first occurrence of an Object starting from location 0 ----- public void remove (Object n);

Now, write a driver program (the class with the public static void main(String[] args) method) nametestarray.java to test the ArrayList data structure you just created. Fill the ArrayList with Card Objects (i.e. you are creating a Deck of Cards -- 52) and print these to the screen. Now, write an additional function that would take this ArrayList of Cards, and shuffle it.

Write a random shuffling routine (do not invoke the shuffling routine from the library) and now display the shuffled ArrayList (Deck) of Cards.

Also test all nineof the above methods. For those that are returning a value, print out the returned value to the screen and for those that are not returning a value, print a message that indicate if it successfully completed its task.

Remember --- The size function should be based upon the actual number of elements you have in the ArrayList at that point in time.

The code is for a deck of cards, please show results.

Reference no: EM132084568

Questions Cloud

New imperialism of the late nineteenth century : What is the connection between the "new imperialism" of the late nineteenth century and the causes of World War I?
How many of tables should be made in a production lot : ABC Enterprise makes a line of coffie table. Some of thesecoffie table are carried in finished goods inventory.
Causes of the european great depression : Identify two causes of the European Great Depression of the 1870s to 1890s.
Identify the major sections of a statement of cash flow : Identify the three major sections of a statement of cash flows. Provide examples of items included in each section. How does management decide which section
Write a random shuffling routine : Write a random shuffling routine (do not invoke the shuffling routine from the library) and now display the shuffled ArrayList (Deck) of Cards.
What are the main ideas of conservatism : What are the main ideas of conservatism, liberalism and socialism (including Marxism, a radical form of socialism)? Make sure to identify both political and eco
Prepare a flexible budget report showing the differences : Prepare a flexible budget report showing the differences (favorable and unfavorable) in manufacturing overhead costs for the month of March
Selling opium to the chinese : What were the problems the europeans hoped to solve by selling opium to the chinese?
How would you evaluate napoleon bonaparte career : How would you evaluate Napoleon Bonaparte's career? Include your thoughts on the way he acquired and exercised power, the changes he introduced

Reviews

Write a Review

Computer Engineering Questions & Answers

  Implement the queue adt using an array

Implement the stack ADT using the Java ArrayList class (without using the built-in Java Stack class). Implement the queue ADT using an array.

  What would you tell russell about advantages of sampling

Basic Sampling: Comprehensive. Reagan Russell is considering opening a multipurpose hardware and lawn store in Anytown, USA.

  What is an entity relationship diagram

What is an Entity Relationship Diagram. In your answer please describe the terms Entity, Attribute

  Which societies is more likely to focus on building relation

Which of the following societies is more likely to focus on building long-term relationships in business? In which of the following societies is a professor ore likely to be called by his/her first name?

  How are attributes represented in an er diagram

What is an ER diagram? How are entities and relationships represented in an ER diagram? How are attributes represented in an ER diagram?

  Who makes cookies and where are they stored

What is a cookie? Who makes cookies, and where are they stored? How do intranets and extranets compare with and differ from the Internet?

  What is the current state of the industry in given regard

How has data mining and predictive analysis worked towards resolving this challenge? What is the current state of the industry in this regard?

  While is it important to denormalize a database

What is the meaning of denormalization, and why can it be desirable? Provide an example.

  What is the purpose of the instruction decoder

What is the purpose of the program counter? What does a sequence controller do?

  Find out whether the list is empty

Write down the functions (in C++) to perform these basic operations on Linked List.

  Differentiate the linker and the compiler

Which of the following components is responsible for loading the initial value in the program counter for an application program before it starts running.

  Create two subclasses of shape- circle and square

Create two subclasses of Shape: Circle and Square. Then, you should write a driver program with a main method that creates an array capable of holding.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd