Problem releated to relationship-inheritance

Assignment Help Basic Computer Science
Reference no: EM13924350

Assignment #3 More OOP - "Is A" Relationship/Inheritance

Grading: For each programming assignment, you are graded by explaining and demoing your code to a TA. You must demo your program BEFORE the next assignment is due, and if you fail to do so, you will automatically lose. Your job is to convince the TA that your program works correctly, i.e. show your TA how to use/break your program Problem Statement (Idea from the MIT OpenCourseWare): You will implement a class called Tool. It should have an int field called strength and a char field called type. You may make them either private or protected. The Tool class should also contain the function void setStrength(int), which sets the strength for the Tool. Create 3 more classes called Rock, Paper, and Scissors, which inherit from Tool. Each of these classes will need a default constructor that sets the strength to 1 and a non-default constructor which will take in an int used to initialize the strength field. The constructor should also initialize the type field using 'r' for Rock, 'p' for Paper, and 's' for Scissors. These classes will also need a public function bool fight(Tool) that compares their strengths in the following way:  Rock's strength is doubled (temporarily) when fighting scissors, but halved (temporarily) when fighting paper. 

In the same way, paper has the advantage against rock, and scissors against paper.  The strength field shouldn't change in the function, which returns true if the original class wins in strength and false otherwise. You may also include any extra auxiliary functions and/or fields in any of these classes.

In addition, you will create a class called RPSGame, which allows a human to play the rock, paper, scissors game against the computer. Your RPSGame must have two Tool for the human and computer tool because you don't know the new tool they'll select with each round. The RPSGame should also have three int fields to keep track of the number of human_wins, computer_wins, and ties.

You can choose the strategy for the computer guesses, but it cannot be based on what the human selected for a tool in the current game!!! Example of a novice and veteran computer AI: https://www.nytimes.com/interactive/science/rock-paper-scissors.html?_r=0
After the human selects the tool for the current game, display the computer's tool, a message describing who won, the current stats for the wins and ties, and then ask the user if he/she wants to play again. Example Play of Game: Welcome to Rock, Paper, Scissors! Do you want to choose different strengths for the tools? (y-yes, n-no) n Choose your tool (r-rock, p-paper, s-scissor, e-exit): r Computer chose scissor.

Reference no: EM13924350

Questions Cloud

Methods of evaluating marketing programs : Question 1: Three commonly used methods of evaluating marketing programs are marketing metrics, marketing dashboards, and marginal analysis.
What two components are involved in valuation procedure : What two components are involved in the two-part valuation procedure? Given the two components in the valuation procedure, which is more volatile?
How normal distribution can be used in operations enviroment : The normal distribution is a family of distributions that is often used to model operational processes. Based on your readings for this module, give one example, different from those supplied in the overview, of how the normal distribution can be ..
What variables affect the aggregate operating profit margin : What variables affect the aggregate operating profit margin, and how do they affect it? What variables determine the level and changes in the market earnings multiplier?
Problem releated to relationship-inheritance : Grading: For each programming assignment, you are graded by explaining and demoing your code to a TA. You must demo your program BEFORE the next assignment is due, and if you fail to do so, you will automatically lose 50 points! Your job is to con..
What is the big-oh complexity for a push : Suppose that a dynamic array stack doubles its capacity when it is full, and shrinks (on Pop only) its capacity by half when the array is half full or less.
Perpetual inventory method : what are the steps to recording and adjusting the lifo Fifo and weighted average. Also what do we record and what don't we record on the perpetual inventory method.
Solve the problem in matlab to find the slowness map : Calculate the maximum and minimum oil in place (STOOIP) for this field -  Use the generalized linear least square formulation to solve the problem in MATLAB to find the slowness map. Can you identify the location and extend of oil spill?
Defined pension plan : Data are available for Joey CO's defined pension plan

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Report on quicksort algorithm in c language

The quicksort algorithm was developed in 1960 by Tony Hoare while in the Soviet Union, as a visiting student at Moscow State University.

  Each letter of a three-letter word stored in memory

Write an LC3 program that "increments" each letter of a three-letter word stored in memory following the program. 'a' becomes 'd', 'n' becomes 'q', 'z' becomes 'c', etc. Make sure you comment your code! This is the Julius Caesar Cipher. Assume that a..

  Employees may work from home

Employees may work from home up to 15 hours per week. Each project leader needs a list of current means of contacting each member of the project team: home phone and home FAX number. To contact employees "on the road" the project leaders also need..

  What do the terms liquidity and solvency mean

we saw how cells of similar size, shape, and function form tissues. As a tissue, muscle is very diverse! Let's kick off our study of muscles by discussing the subtypes of muscle tissue, beginning with smooth muscle. Where do we find this muscle tissu..

  The government should never use fiscal policy

The government should never use fiscal policy to combat business cycle fluctuations coming from changes in autonomous investment if it also wishes to keep longer term movements in the price level to a minimum. Is this claim true, false or uncertain?

  What are the reasons for having variable-length records

What are the reasons for having variable-length records. What type of separator characters are needed for each. Illustrate with examples.

  Gcd that returns the greatest common divisor

Write method Gcd that returns the greatest common divisor of two integers. Incorporate the method into an application that reads two values from the user and displays the result

  What is the large part of being a successful it professional

Using the right tool for the job is a large part of being a successful IT professional.

  Design a wan replication topology

Design a WAN Replication Topology

  Determining the placement of the fsmo roles

Explain the steps for determining the placement of the FSMO roles for the Acme Widget Technical School. How are these roles determined, implemented, maintained, and monitored

  Use the mvc design pattern to create a gui program

Use the MVC design pattern to create a GUI program for Triangle objects. Include a form for users to enter values for a triangle;s three sides and a button that when clicked, displays data from the Triangle object created from the input.

  Explain the two methods which are used to give concurrent

describe the two methods that are used to provide concurrent operations of multiple processes on a single cpu. what are

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