Compute the maximum points scored by player one and two

Assignment Help JAVA Programming
Reference no: EM131081987

Badminton Scoring - Java program - using API

The following is a score of a single game in badminton. The top row is the score for Player 1. The second row is the score for Player 2. Represent this data in an ArrayListin a class called BadmintonScoring.

0

1

2

 

 

 

 

 

3

4

 

 

 

 

 

 

 

 

 

 

5

 

 

 

 

 

 

0

 

 

1

2

3

4

5

 

 

6

7

8

9

10

11

12

13

14

15

 

16

17

18

19

20

21

I. Compute the maximum points scored by Player 1 and Player 2.

II. Compute the maximum number of points scored in a continuous sequence by Player 1 and Player 2. Hint: Player 1 scored the sequence 0-1-2, which implies s/he scored 2 points in a continuous sequence. Similarly, for Player 2, 16-17-18-19-20-21 implies that s/he scored 5 points in a continuous sequence

III. Extend BadmintonScoring to associate each point scored by a player with a particular stroke that earned that point, using the notion of association list. You can represent each point as an object and store the score of a player in an association list (refer to Chapter 7, section 7.4.2 for details). For example, when Player 1 scored his/her first point, instead of just 1, it could have been {1, slice}. Thus, each point is augmented with the type of stroke from the following list:

a. slice
b. drive
c. smash
d. drop
e. net-shot

IV. Store the following score of a single game using the modified BadmintonScoring class.

0

1

a

2

c

 

 

 

 

 

3

a

4

c

 

 

 

 

 

 

 

 

 

 

5

c

 

 

 

 

 

 

0

 

 

1

d

2

e

3

d

4

e

5

d

 

 

6

e

7

e

8

a

9

d

10

e

11

e

12

e

13

e

14

e

15

e

 

16

e

17

e

18

e

19

e

20

e

21

a

V. Identify the type of stroke that earned most points for each player.

BadmintonScoring

Attributes
+ int[][] scores
+ static final int PLAYER1
+ static final int PLAYER2
- Operations
+ public int getContinuousPointsPlayerl()
+ public int getContinuousPointsPlayer2()
+ public int getPlayerlPoints()
+ public int getPlayer2Points()

BadmintonScoringWithStroke

- Attributes
+ ArrayList<Point> scores
+ int scorel
+ int score2
+ static final int PLAYER1
+ static final int PLAYER2
- Operations
+ public String getMostUsedStrokePlayerl()
+ public String getMostUsedStrokePlayer2()

Point

- Attributes
+ private int player
+ private int score
+ private static final int PLAYER1
+ private static final int PLAYER2
+ private String stroke
- Operations
+ public int getPlayer()
+ public int getScore()
+ public Point(int player, String stroke, int value)
+ public String getStroke()

Reference no: EM131081987

Questions Cloud

Important decision for operational risk managers : An important decision for operational risk managers is the extent to which operational risks should be insured against. What are the two major problems facing an insurance company?
Discuss whether you think this statement is a valid one : In addition it is virtual that the " whole organization sings the same song when implementing the marketing strategy". Discuss whether you think this statement is a valid one, assess the pros and cons of the organization wide implementation of mar..
Modify the cellular telephone coding system : To communicate one bit of information reliably, cellular phones transmit the same binary symbol five times. Thus the information "zero" is transmitted as 00000 and "one" is 11111. The receiver detects the correct information if three or more binar..
Goal of achieving a specific task : Create an agenda for a team meeting on a topic of your choice. Draw from your own experience working within a group with the goal of achieving a specific task. You may use your experience as a student working in a group, or develop a plan for a fu..
Compute the maximum points scored by player one and two : Compute the maximum points scored by Player 1 and Player 2. Compute the maximum number of points scored in a continuous sequence by Player 1 and Player 2.
Problem regarding the targeting specific customers : Competitors are firms competing in the same market, offering products that are similar, while targeting specific customers in order to gain a competitive advantage. In this assignment you will demonstrate your understanding of how to create and ma..
What is the present value of an annuity : What is the present value of an annuity of $1,000 paid every year for five (5) years when the funds are received at the beginning of the year discounted at a rate of 9.0 percent.
Capability development in an organization : Discuss the different types of knowledge processes within an organization that focus on the acquisition of new knowledge vs. those processes that build on existing knowledge. Then, discuss how these processes promote capability development in an o..
Amount of deposits made over the time period : How much money will you have after 17years? Compare this amount to the total amount of deposits made over the time period.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Need a console program

Need a console program that repeatedly prompts the user to enter data until they type done (any case, Upper, Lower, or Mixed).

  What is the purpose of the pivot value in quicksort

What is the purpose of the pivot value in quicksort and How did we first select it in the text, and what is wrong with that approach for choosing a pivot value?

  Implement a shopping cart class with user interface

project will be to implement a shopping cart class with user interface (UI) that contains main() in Net Beans. The UI class will be used to perform user input/output and to invoke the appropriate methods of shopping cart class. When your program star..

  Program that allows a user to input coordinates

In Java make a program that allows a user to input coordinates as to make a Hexagon via an array, and my professor has set the standards of: Write a class Polygon which draws a hexagon for a set of numbers given by the user.

  Calculates the product of the following sequence

Write a java code that calculates the product of the following sequence of numbers using for/loop and do/while/loop

  The ai player will not be asking

The AI player will not be asking the user for any input. This means that placeShips() and fire() should not ask the user for locations. The AI player should choose locations of ships and automatically place them

  Java shape program console

Program is adequately documented. It's comments identifies its name, purpose, author and date. Throughout the code, comments and/or relevant component names should attempt to make the program understandable.

  List data structures to be used in solution

write a program that will prompt the user for an input file name to read from. The Input file will consist of records made up of first name, last name and an account balance of individuals and store the individuals in an ArrayList.

  Write a program that converts number from binary to decimal

write a program that Converts a Number from Binary to Decimal  by using reading keyboard input.

  Complete java program that provides a method

Write a complete Java program that provides a method named splitStack, which takes aStack of integers as a parameter and splits it into negatives and non-negatives.

  Write a method named rowofstars

Write a method named rowOfStars that takes a single integer parameter n and returns a String with that many stars in it.

  Hash-join algorithm

In this assignment, you will have a chance to implement the hash-join algorithm for a DBMS. You can use C, C++, or Java to write the program. However, your program should include su- cient comments to make it readable. You need to turn in

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