1 rock-paper-scissors simplejavaproblems 1-3 are based on

Assignment Help JAVA Programming
Reference no: EM13347232

1: Rock-Paper-Scissors : Simple.java

Problems 1-3 are based on the Rock-Paper-Scissors game. If you are unfamiliar with the game, please see en.wikipedia.org/wiki/Rock-paper-scissors.

You will implement two di erent rock-paper-scissors players by extending the RPS class that is provided in culearn. Download this class and read through the class. You will find
three abstract methods that you must implement. Pre and Postconditions for these methods are included in the RPS.java le provided.

Write a Java class called Simple that extends the provided RPS class. Your class must implement all of the abstract methods found in the RPS class according to the following
guidelines:

1. The gesture() method will always output the same value each time it is called. The value (String) returned will be the same as the name of the current object (as defi ned
in the constructor; see below). Thus, the name of the object must be one of \Rock", \Paper" or \Scissors".

2. The update() method must update the current players statistics (stats) as speci ed by the pre/postconditions in the RPS class.

3. The toString() method must be implemented according to the speci cation in the RPS class.

Your class must have the following constructor:

public Simple(String name, byte id){...}

where name will be both the players name and the kind of gesture it always returns. If the constructor is called with a name that is not one of \Rock", \Paper" or \Scissors", your
constructor will automatically change the name to \Paper".

Do not add any other public attributes, methods or constructors to your class. Do not include a main method in your class.

2: Rock-Paper-Scissors : Clever.java

Write a Java class called Clever that extends the provided RPS class. Your class must implement all of the abstract methods found in the RPS class according to the following
guidelines:

1. The gesture() method will output one of \Rock", \Paper" or \Scissors", based on the arti cial intelligence that you add to you method.

If a series of games are being played between two players, the two arrays of Strings that are input to the method give the history of gestures played so far between the
players. You may want to use this information when choosing which gesture to play.

You may add any hidden (private) attributes or methods that you need to help you.

You will not receive any correctness or design marks if your class outputs the same gesture each time or if your class returns a random gesture each time. You must add
some 'intelligence' to it.

2. The update() method must update the current players statistics (stats) as speci ed in the RPS class. This method should also update any hidden (private) attributes that
you have added to your class.

3. The toString() method must be implemented according to the speci cation in the RPS class. (This will be the same method from your Simple class. You do not have to
do anything di erently here.)

Your class must have the following constructor:

public Simple(String name, byte id){...}

where name will be the name of your player.

Do not add any other public attributes, methods or constructors to your class. (Do add private attributes and/or methods to help you!) Do not include a main method in your class.

3: Rock-Paper-Scissors Challenge

Rename your Clever class with another name of your choice. We will take all submissions for the bonus and play a rock-paper-scissors tournament and your grade will be determined by how well your players does against the rest of the class.

You must change every instance of \Clever" in your class to your new class name. Your new class name should be unique in the class (you do not have to use any personal identifying information; but you may if you wish). Follow these guidelines:

1. Do not use simple or obvious names like MyRPS, MyPlayer, AwesomePlayer, Clever1, MyClever, etc. These names would likely be chosen by several people (and any two
classes with the same name will cause delays in grading).

2. Be creative but do not use any o ensive names.

3. Don't use extremely long or short names.

You must also create a text le called name.txt that contains a single line. That single line must be the name of your class.

4: Stack ADT

Consider the following abstract data type:

String Stack

data                                                  operations
a collection of strings                       - add a string to the collection
(need not be unique)                       - remove a string from the collection using LIFO principle
                                                        - ask if the collection is empty or not
                                                        - ask what the next string removed would be
                                                        - ask how many strings are in the collection

A stack corresponds to the natural notion of a stack that we have. For example, if you look at a stack of plates (see link) you would normally add a new plate to the stack at the
top of the stack. When you remove a plate, you would remove the top plate which will have been the last one added. (Assume that you only add/remove one plate at a time.)

Even though an ADT does not specify how the data will eventually be stored, using the above notion of a stack of plates, we will use the word top to denote the position of the last added item to the stack. So when you add something to the stack, you put it on the top of the stack. And when you remove an element from a stack, you remove it from the top. Similaraly, when you look at which item would be removed next, you look at the top of the stack.

Write a Java class called StringStack, which implements the string stack ADT given above. Your implementation must have the following attribute, methods and constructor:

public static final boolean bonus = false;
public void push(String element){...}
public String pop(){...}
public String peek(){...}
public boolean isEmpty(){...}
public int size()
public StringStack(){...}

The contracts (pre and postconditions) for the methods are listed at the end of this question. There should be no other public attributes, methods or constructors in your class.
You may add any private attributes or methods as you need.

You may not use any of Java's classes (like ArrayList or any of the Stack classes) in your solution. You will receive zero marks for this problem if you do. If you are unsure if you are violating this condition please ask (Piazza). You may use arrays.

Your stack must be able to hold at least 1024 strings in it. For bonus marks, implement your stack so that it can have an arbitrarily large number of strings in it (i.e. the size should only be constrained by the amount of memory your program is given to run). If you do the bonus part of the assignment, you must change the value of static attribute bonus to true. We will not test your code for the bonus parts unless this variable is true.

5: Testing Stack ADT

Write a Java class called TestStringStack, which tests your StringStack class.

Your testing progeam should provide test cases to show that the public methods of the StringStack class are working properly. Your program should display to standard output
some useful information during the tests and a summary at the end. The summary should include how many tests were performed and how many passed/failed.

At the end of your TestStringStack.java le, include a comment block describing at least 5 (di erent) text cases for the pop() method.

Reference no: EM13347232

Questions Cloud

Toms pizza sells for 500 ea and serves an average of 425 : toms pizza sells for 5.00 ea and serves an average of 425 customers per week. during a recent sale tom lowered the
1 explain the differences between our specifications of the : 1. explain the differences between our specifications of the sorted list adt and the binary search tree adt.2. define a
Write a paper describing the influence the experiences have : write a paper describing the influence the experiences have made on the persons development. bulldiscuss the social
1a substantial percentage of the companies noted on the : 1a substantial percentage of the companies noted on the nyse and nasdaq dont pay dividends but investors are
1 rock-paper-scissors simplejavaproblems 1-3 are based on : 1 rock-paper-scissors simple.javaproblems 1-3 are based on the rock-paper-scissors game. if you are unfamiliar with
At-f 7357r 83 df 4df 3203df 98 p gt 05 : assignment-f 7.357r .83 df 4df 3203df 98 p gt .05 p lt .05 p lt .01question 1. what statistical
Part-1you are required to research a suitable organisation : part-1you are required to research a suitable organisation of your choice and in a formal report undertake the
Explaining the statement consider the role of the hr : explaining the statement consider the role of the hr department facilitator or organiser? should include reference
Case studyfind and read the judgment in p j mccarthy amp : case studyfind and read the judgment in p j mccarthy amp sons pty ltd v q paint pty ltd 2013 qsc 39 and answer the

Reviews

Write a Review

JAVA Programming Questions & Answers

  Graphicsframe class

This program makes use of the GraphicsFrame class and the Drawable interface. Your missions is to create the class Airplane. Each Airplane object should store the following information (fields): manufacturer modelNumber maximumSpeed // in knots maxim..

  Write a program that prompts for and accepts input of test

write a program that prompts for and accepts input of test ggrades that are integers between 0 and 100. For each numerical test grade,  program should display a corresponding letter grade

  Using a link list implementation

Using a link list implementation, simulate the war car game. The program should read an input of several line of card values and output the winner and the number of rounds it takes.

  The sixth amendment allows the due process right to council

The Sixth Amendment allows the due process right to council. Several Supreme Court cases have clarified this right for those who cannot afford their own attorneys. Discuss the right to an attorney for indigent defendants. What are the three main syst..

  Structure named dog with a string field

Create a Structure named dog with a string field for the Dog's name. Create a Structure named Cat with a string field for the Cat's name. Write a program that declares one Dog and one Cat, and assign names to them. Write two overloaded functions n..

  Build a simple text-based adventure game

Build a simple text-based adventure game. You can and probably should use our Missed Connections example as the foundation for your game.

  Java program to decide whether integer is perfect number

For example, 6 is a perfect number because 6 = 1 + 2 + 3. Write a Java program that decides whether integer is a perfect number.

  Program to translates a number into the closest letter grade

Write a program that translates a number into the closest letter grade. For example, the number 2.8 (which might have been the average of several grades) would be converted to B-. Break ties in favor of the better grade

  A common useful equation

In physics, a common useful equation for finding the position s of a body in linear motion at a given time t, based on its initial position s0, initial velocity v0, and rate of acceleration a, is the following: ??= ??0+??0??+12????2. Write code to de..

  Write a program that displays a drawing popular hangman game

Write a program that displays a drawing for the popular hangman game, as shown in Figure 15.32(c). draws a sketch for the hangman game.

  Java program to find solution of cryptarithmetic puzzle

A solution to puzzle is S=9, R=8, O=0, M=1, Y=2, E=5, N=6, D=7. Write down a java program which finds solution to cryptarithmetic puzzle of: TOO + TOO + TOO + TOO = GOOD.

  Design a small wbis using elements from the disciplines

Design a small WBIS using elements from the disciplines of web design, database design, software engineering and object modelling;be able to develop a small WBIS using HTML forms, Java Servlets and cookies.

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