代写Assignment|Java作业 – 2D arrays and inheritance

代写Assignment|Java作业 – 这是一个基础的java训练题目,着重是二维数组方面的考察

Asgn 9 2D arrays and inheritance

What to submit: your java file, and a pdf of this java file, submitted through D2L (no paper copy)

IMPORTANT: Submissions with no PDF files for the code will

not be marked (i.e., you will get zero on it)

Individual work please for the steps below!!

This assignment has 2 independent parts. The 2 parts have equal weights toward the mark for this assignment.

Part 1 2D arrays

For this part of the assignment, you should first download the solution to Lab10. Add a method findSeasonWithHighestVariation in the QuarterlySalesBySalespersons class. This method does not have parameters, and it returns one of the seasons (as a String). The method should calculate the difference between the highest sale and the lowest sale among all salespersons, for each of the seasons. For the year1 object, this would be:

  • In Winter: 253.89 (1234.00 980.11)
  • In Spring: 519.12 (1885.99 1366.87)
  • In Summer: 329.24 (1548.33 1219.09)
  • In Fall: 665.38 (2001.00 1335.62) Then, your code should identify the largest difference, and return the corresponding month. In the case here, this would be Fall.

Call this method on both of your objects in the main method and print the results. You should get that both are Fall.

Part 2 inheritance

For this part of the assignment, you need the files HumanPlayer.java, ComputerPlayer.java, and Asgn9.java. This code is for playing the rockpaperscissors game, but it uses separate classes to handle what the human player (user) and the computer player are doing. As a first step, make sure you understand this code and run it.

As you can see, there is a lot of repeated code in the HumanPlayer and the ComputerPlayer classes. What you need to do here is to create a base class named Player, and make the current 2 classes inherit from this one. The Player class should contain all the code that is common to both original classes. It is important to ensure that the new program works just like the old one (i.e., run it). Note: when you put something in the base class, you should also remove it from the derived classes. Hint: one of the instance variable will have to become protected…

发表评论

电子邮件地址不会被公开。 必填项已用*标注