Q1.2: Explain the different methods for random media access control? (5 marks)
Differentiate among flow control mechanisms by taking suitable examples.
Develop a python application that will simulate a simple dice game by rolling two dice for the player as his bet followed by another roll of the two dice for the computer.
The mechanics as is follows:
1. If after the roll of the two dice, resulted to same number, then the sum will be doubled.
2. If the value of each dice is different, then just get the sum of the values of each dice.
Who gets the highest value wins the game.
I need the code to have an output stated above.
Develop a python application that will randomly select n integers from 1 to 9 and will count the number of occurrence of the numbers without using the Counter from collections library.
Sample Output 1:
How many numbers?: 5
[4, 6, 8, 3, 3]
1-4
1-6
2-3
I need the code to have an output stated above.
Create a program that will String input. Based on the number of inputs, the user will decide what shape it is. (1 input – circle, 2 inputs – square or rectangle, 3 inputs - triangle). The program will then display the shape type, details, perimeter and area.
Justines-MacBook-Pro:classes Justine$ java-jar Shape.jar15
Type:Circle
Radius:15
Perimeter:94.2
Area:706.5
Justines-MacBook-Pro:classes Justine$ java-jar Shape.jar15
Type:Rectagle
Length:24
Width:12
Perimeter:72.0
Area:288.0
Justines-MacBook-Pro:classes Justine$ java-jar Shape.jar15
Type:Square
Side:12
Perimeter:48.0
Area:144.0
Justines-MacBook-Pro:classes Justine$ java-jar Shape.jar 9 15 12
Type:Triangle
Sides:9, 15, 12
Perimeter:36.0
Area:54.0
Justines-MacBook-Pro:classes Justine$ java-jar Shape.jar 9 15 12 8
Invalid input
Simple Dice Game
Develop a Python application that will simulate a simple dice game by rolling two dice for the player as his bet followed by another roll of the two dice for the computer.
The mechanics is as follows:
1. If after the roll of the two dice, resulted to same number then the sum will be doubled.
2. If the value of each dice is different, then just get the sum of the values of each dice.
Who gets the highest value wins the game.
Frequency of Numbers
Develop a Python application that will randomly select n integers from 1 to 9 and will count the number of occurrence of the numbers without using the Counter from collections library.
Sample Output:
How many numbers?: 7
[2, 6, 8, 2, 1, 1,6]
2-2
2-6
1-8
2-1
Write a program that takes as input from the user three sides of a triangle (numbers), checks and displays
whether the triangle is a right-angled triangle or not.
You are asked to draw the following stick figure on the screen-Design the problem and draw the structure chart.
Julio Cesar Chavez Mark VII is an interplanetary space boxer, who currently holds the championship belts for various weight categories on many different planets within our solar system. However, it is often difficult for him to recall what his "target weight" needs to be on earth to make the weight class on other planets. Write a Java program to help him keep track of this. Create a Weight class in which you will have your main method. Perform all the inputs, calculations, and outputs in the main method.
It should ask him what his earth weight is, and to enter a number for the planet he wants to fight on. It should then compute his weight on the destination planet based on the table below:
#
Planet
Relative gravity
1. Venus: 0.78
2. Mars: 0.39
3. Jupiter: 2.65
4. Saturn: 1.17
5. Uranus: 1.05
6.Neptune: 1.23
information for the following planets:
1. Venus 2. Mars 3. Jupiter
4. Saturn 5. Uranus 6. Neptune
Which planet are you visiting?