Compulsory Task 1 Follow these steps: Create a new file called rockPaperScissors.java Write a program that allows the user to play rock, paper, scissors. The program should randomly generate a number (0, 1 or 2), which represents scissors, rock and paper, respectively. (Hint: look up Math.random) The program should then prompt the user to enter a number (0,1 or 2). • Once the user has entered their number, the program should inform them whether they win, lose or draw. • The rules of the game are as follows: Scissors beats paper o o Rock beats scissors o Paper beats rock

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Compulsory Task 1
Follow these steps:
Create a new file called rockPaperScissors.java
Write a program that allows the user to play rock, paper, scissors.
The program should randomly generate a number (0, 1 or 2), which
represents scissors, rock and paper, respectively. (Hint: look up
Math.random)
• The program should then prompt the user to enter a number (0,1 or 2).
Once the user has entered their number, the program should inform
them whether they win, lose or draw.
The rules of the game are as follows:
o Scissors beats paper
Rock beats scissors
o Paper beats rock
Compulsory Task 2
Follow these steps:
Create a new file called averageNumber.java
Write a program that determines how many positive and negative
integers have been entered and calculates the total and average of all the
entered numbers.
Transcribed Image Text:Compulsory Task 1 Follow these steps: Create a new file called rockPaperScissors.java Write a program that allows the user to play rock, paper, scissors. The program should randomly generate a number (0, 1 or 2), which represents scissors, rock and paper, respectively. (Hint: look up Math.random) • The program should then prompt the user to enter a number (0,1 or 2). Once the user has entered their number, the program should inform them whether they win, lose or draw. The rules of the game are as follows: o Scissors beats paper Rock beats scissors o Paper beats rock Compulsory Task 2 Follow these steps: Create a new file called averageNumber.java Write a program that determines how many positive and negative integers have been entered and calculates the total and average of all the entered numbers.
Firstly, ask the user to enter any number of integers. The user should enter
O to indicate the end of their input.
• The program should then determine the number of positive and negative
integers entered by the user, and print out the result.
• The total of all integers entered as well as the average should then be
calculated and displayed.
Compulsory Task 3
Follow these steps:
Create a new file called factorial.java
• Write a program that determines the factorial of a number entered by a
user.
• Prompt the user to enter a positive integer.
Then calculate the factorial of the given number. For any positive integer
n, its factorial is given by:
o factorial = 1*2*3...*n
• Finally, print out the factorial.
Transcribed Image Text:Firstly, ask the user to enter any number of integers. The user should enter O to indicate the end of their input. • The program should then determine the number of positive and negative integers entered by the user, and print out the result. • The total of all integers entered as well as the average should then be calculated and displayed. Compulsory Task 3 Follow these steps: Create a new file called factorial.java • Write a program that determines the factorial of a number entered by a user. • Prompt the user to enter a positive integer. Then calculate the factorial of the given number. For any positive integer n, its factorial is given by: o factorial = 1*2*3...*n • Finally, print out the factorial.
Expert Solution
steps

Step by step

Solved in 6 steps with 3 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY