Your Perfect Assignment is Just a Click Away

We Write Custom Academic Papers

100% Original, Plagiarism Free, Customized to your instructions!

glass
pen
clip
papers
heaphones

IT 232 PUG Web Development Languages Project

IT 232 PUG Web Development Languages Project

Description

In this scenario, your group has been tasked with creating a score keeping program for games.

You have been assigned to create and test the classes necessary. You will create a single, console program with multiple sections. In it, you will create a base class and an inherited class using the class diagrams you created previously as a guide. Then you will write code to instantiate objects from each class and test their functionality. Please keep in mind that with all the assignments in this course, any given scenarios are hypothetical and intended solely to demonstrate specific skills.

Challenge: Once you have created the following console program and tested it to make sure all of its specifications work, why not go back and try creating a GUI to use the derived class? (This challenge does not count as part of your assignment grade and is not required.)

Assignment Requirements

Using the language in which you have chosen to focus: C#, Java, Web Development languages (PHP and JavaScript), please complete the following Assignment:

The program for this assignment will consist of four sections, each headed by the three-line comment below:

Section 1:

  1. Enter the comment with the section title as described above.
  2. Create a base class called scoreKeeper.
    1. Include a private property called gamePlayed to contain the name of the game being played.
    2. Add a private property which will allow for any number of players. A dictionary or dynamic array would be a good option. The container will hold the names and scores of the players.
    3. Include a new public method, addName(), to accept a player’s name and insert it into the container. (Note: If the container you used does not have an add method to easily add a value, you will need to include code to determine the next available position.)
    4. Include a public method, getPlayerName(), to accept the number of the player and return the player’s name.
    5. Include a public method setGame() to update the gamePlayed property by passing it a string containing the name of the game.
    6. Include a public method getGame() to retrieve the name of the game.
    7. Include a public method, addScore(), to update a player’s score by passing it the player’s name and the points to be added. Return the updated score.
    8. Include a public method, subScore(), to update a player’s score by passing it the player’s name and the points to be subtracted. Return the updated score.
    9. Include a new public method, listAllScores(), to print the name of the game being played, the names of each player and their respective scores.
    10. Include two constructors. The first one is a default constructor. The second is a constructor method which will accept the name of the game and call the setGame().

Section 2:

  1. Enter the comment with the section title as described above.
  2. Some games have additional information that must be monitored during play. Create a sub-class called baseball that inherits from the base class scoreKeeper.
    1. Add private integer properties for fouls, balls, strikes, and outs.
    2. Add a private decimal property to hold the inning number. Whole numbers will indicate the top of the inning and half numbers will indicate the bottom. e.g. 5.5 would indicate the bottom of the 5th
    3. Include a public method, advOuts(), to add 1 to the number of outs. If the number of outs reaches 3, reset balls, strikes, fouls and outs to 0 and add .5 to innings.
    4. Include a public method, getOuts(), to return the current number of outs.
    5. Include a public method, advStrikes(), to add 1 to the number of strikes. If the number of strikes reaches 3, call advOuts().
    6. Include a public method, getStrikes(), to return the current number of strikes.
    7. Include a public method, advFouls(), to add one to the number of fouls. If the number of strikes is less than 2, advFouls() should also add one to strikes.
    8. Include a public method, getFouls(), to return the current number of fouls.
    9. Include a public method, advBalls(), to add one to the number of balls. If the number of balls reaches 4, reset balls, strikes and fouls. (This means the player has been given a walk to first base but does not guarantee and runs were scored.
    10. Include a public method, getBalls(), to return the current number of balls.
    11. Include a public method, getInning(), to return the current inning.
    12. Include two constructors. The first one is a default constructor. The second is a constructor method which will accept the name of the home team followed by the name of the visiting team. It will then call the setGame() and pass it a combined name such as “Cubs vs Braves”. It will also call the addName() method to add the two teams to the players property.

Section 3:

  1. Enter the comment with the section title as described above.
  2. Write code to test the base class. This can be done multiple ways and should be when throughly testing your code. However, for this assignment’s output, we will use the following method:
    1. Print to the console the message, “Assignment 10 – Classes and Inheritance” followed by a blank line.
    2. Print “Section 3: Base Class Results After Adding” to the console followed by a blank line.
    3. Instantiate an object called gameOne, from the scoreKeeper class, passing “Canasta” as the game name to the constructor.
    4. Call the addName() method three times to add the players, “Larry”, “Moe”, and “Curly”.
    5. Print a blank line to the console for ease of reading.
    6. Call the object’s addScore() method three times. Once for Larry adding 20 points to his score. A second time for Moe adding 35 points to Curly’s score. Then a third time for Curly, adding 45 points to Curly’s score.
    7. Using the listAllScores() method, print a report of the players and their respective scores to the console.
    8. Call the object’s subScore() method twice. Once for Moe subtracting 15 points from his score. The second time, subtract 5 points from Curly’s score.
    9. Print “Section 3: Base Class Results After Subtracting” to the console followed by a blank line
    10. Using the listAllScores() method, print a report of the players and their respective scores to the console.
    11. Print two blank lines to the console.

Section 4:

  1. Enter the comment with the section title as described above.
  2. Write code to test the sub-class. This can be done multiple ways and should be when thoroughly testing your code. However, for this assignment’s output, we will use the following method:
    1. Print “Section 4: Derived Class Results: Baseball scoring” to the console followed by a blank line.
    2. Instantiate an object called gameTwo, from the baseball class, passing “Cubs” and “Braves” as the teams, (or teams of your choosing), to the constructor. (Note: If you choose to use different team names, be sure you substitute them below for ‘Cubs’ or ‘Braves’.
    3. The following method calls should be done in order to guarantee the correct results.
      1. Call the addScore() method to advance the Cubs’ score by 2.
      2. Call the advOuts() method three times.
      3. Call the addScore() method to advance the Braves’ score by 3.
      4. Call the advOuts() method once.
      5. Call the advStrikes() method once.
      6. Call the advFouls() method thrice.
      7. Call the advBalls() method once.
      8. Call the listAllScores() method to print the game and scores. Also, print a blank line to the console.
      9. Use the appropriate get methods to print the current inning, outs, strikes, fouls, and balls.

EXPECTED OUTPUT

Assignment 10 – Classes and Inheritance

Section 3: Base Class Results After Adding

The scores for Canasta:
Larry’s score is 20
Moe’s score is 35
Curly’s score is 45

Section 3: Base Class Results After Subtracting

The scores for Canasta:
Larry’s score is 20
Moe’s score is 20
Curly’s score is 40

Section 4: Derived Class Results: Baseball scoring

The scores for Cubs vs Braves:
Cubs’s score is 2
Braves’s score is 3

The current inning is 1.5
Outs: 1
Strikes: 2
Fouls: 3
Balls: 1

Order Solution Now

Our Service Charter

1. Professional & Expert Writers: Writers Hero only hires the best. Our writers are specially selected and recruited, after which they undergo further training to perfect their skills for specialization purposes. Moreover, our writers are holders of masters and Ph.D. degrees. They have impressive academic records, besides being native English speakers.

2. Top Quality Papers: Our customers are always guaranteed papers that exceed their expectations. All our writers have +5 years of experience. This implies that all papers are written by individuals who are experts in their fields. In addition, the quality team reviews all the papers before sending them to the customers.

3. Plagiarism-Free Papers: All papers provided by Writers Hero are written from scratch. Appropriate referencing and citation of key information are followed. Plagiarism checkers are used by the Quality assurance team and our editors just to double-check that there are no instances of plagiarism.

4. Timely Delivery: Time wasted is equivalent to a failed dedication and commitment. Writers Hero is known for timely delivery of any pending customer orders. Customers are well informed of the progress of their papers to ensure they keep track of what the writer is providing before the final draft is sent for grading.

5. Affordable Prices: Our prices are fairly structured to fit all groups. Any customer willing to place their assignments with us can do so at very affordable prices. In addition, our customers enjoy regular discounts and bonuses.

6. 24/7 Customer Support: At Writers Hero, we have put in place a team of experts who answer all customer inquiries promptly. The best part is the ever-availability of the team. Customers can make inquiries anytime.