Part A: (5 Marks)
- Write a program that lets the user play the game of rock, paper, scissor against the computer. The Program should work as follows
a. The program should start with giving user an option that if he wants to play the game (yes/no). If the user selects yes, the game should start, otherwise it should terminate.
b. When the program begins, a random number in the range of 1 through 3 is generated. If the number is 1, then the computer has chosen the rock. If the number is 2, then the computer has chosen paper. If the number is 3, then the computer has chosen scissors. (Do not display the computer choice yet)
c. The user enters his/her choices of “rock”, “paper”, or “scissors” at the Keyboard.
d. The computer’s choice is displayed
e. A winner is selected according to the following rules
• If one player chooses rock and the other player chooses scissors, then the rock wins. (The rock smashes the scissors)
• If one player chooses scissors and the other player chooses paper, then scissors wins. (Scissors cut the paper)
• If one player chooses rock and the other player chooses paper, the paper wins. (the paper wraps the rock)
• If both players make the same choice, the game must be played again to determine the winner.
f. After the game finishes it should give user an option again that if he wants to play (yes/no)
Part B: (5 Marks)
Create a class called Donor which represents a donor to an organization. It stores the donor’s name, amountDonated and rating.
Donor ratings is calculated based on the following schedule
- a) amt = 0 – none
- b) amt < $100 – low level
- c) amt >= $100 and amt < $1000 – medium level
- d) amt >= $1000 – high level
Add the following methods to the class
- A constructor for the class Donor
- getName() method to get the name of the Donor
- getRating() to get the rating of the Donor
- set.name() to ensure that the name only contains characters
- set.amountDonated()to ensure that the amountDonated only contains numbers
- set.rating() to ensure that the ratings can be set only to “none”, “low”, “medium” and “high”
- DonateAmount() donate more money as a donor
- updateRatings() To Update the rating for the donor every time the donation is made.
- DisplayDetails() Display all the properties for Donor
Create a driver program in a script file
- Create three Donor objects with the following properties
Object Name amountDonated rating
D1 Ahmed 0 None
D2 John 100 Low
D3 Ali 900 Medium
- Call Donate amount for each object with the following amount
- Call updateRatings method for each object to update the ratings based on the new donations.
- Call DisplayDetails() for each donor to display the current status for the donor. NOTE: Submit the program codes and screenshots of the tests
The post Game Analysis appeared first on ACED ESSAYS.
I absolutely LOVE this essay writing service. This is perhaps the tenth time I am ordering from them, and they have not failed me not once! My research paper was of excellent quality, as always. You can order essays, discussion, article critique, coursework, projects, case study, term papers, research papers, reaction paper, movie review, research proposal, capstone project, speech/presentation, book report/review, annotated bibliography, and more.
STUCK with your assignments? Hire Someone to Write Your papers. 100% plagiarism-free work Guarantee!