1, For each loop with example
2, do while loop with example
Below is a nested MPLS network by MTN. With the assumption that Customer 6 (C6) is connected to Router 6 (R6), execute a Dijkstra Algorithm on a Link State routing to determine the shortest path for Customer 6 to transmit packets to every other Customer/Destination connected to the rest of the Routers on the network.
a. Tabulate the executed iteration for the Dijkstra Algorithm using the table below.
Iteration
0 1 2 3 4 5 6 7 8 9
Nodes
[6]
[6,3]
[6,3,2] [6,3,2,1] [6,3,2,1,4] [6,3,2,1,4,5] [6,3,2,1,4,5,7] [6,3,2,1,4,5,7,8] [6,3,2,1,4,5,7,8,9] [6,3,2,1,4,5,7,8,9,10]
R1 R2 R3 R4 R5 R7 R8 R9 R10
Your program should first greet the player and then offer him/her to enter Rock, Paper, or Scissors option. The player should enter one of the three. You need to check that the player always enters one of the correct options. If she enters a wrong option you should ask her to try again.
Next, the computer randomly “picks” rock, paper or scissors as well, and the program prints out the result according to the rules of the game.
The program should also keep the overall score and print it out after each game.
After each game, the program should ask the player if she wants to continue. If the player says “yes” the game continues in the same manner.
Two cars A and B leave an intersection at the same time. Car A travels west at an average speed of x
miles per hour and car B travels south at an average speed of y miles per hour. Write a program that
prompts the user to enter the average speed of both the cars and the elapsed time (in seconds) and
outputs the total distance each car has traveled as well as the shortest distance between the cars.
Output data MUST be rounded to 2 decimal places and have precision set so that all data is evenly lined
up. For simplicity, assume that decimal numbers will be no more than 8 digits long.
QUESTION ONE
1.1 In this task, you are to create a simple registration form. Use the sample below:
USERNAME:
PASSWORD:
CONFIRM PASSWORD:
FIRSTNAME:
SURNAME:
EMAIL:
QUALIFICATION:
CELL NUMBER:
GENDER:
NATIONALITY:
CANCEL
Below is a nested MPLS network by MTN. With the assumption that Customer 6 (C6) is connected to Router 6 (R6), execute a Dijkstra Algorithm on a Link State routing to determine the shortest path for Customer 6 to transmit packets to every other Customer/Destination connected to the rest of the Routers on the network.
a. Tabulate the executed iteration for the Dijkstra Algorithm using the table below
Rearrange Numbers in String
Given a string, write a program to re-arrange all the numbers appearing in the string in decreasing order. Note: There will not be any negative numbers or numbers with decimal part.
Input
The input will be a single line containing a string.
Output
The output should be a single line containing the modified string with all the numbers in string re-ordered in decreasing order.
Explanation
For example, if the given string is "I am 5 years and 11 months old", the numbers are 5, 11. Your code should print the sentence after re-ordering the numbers as "I am 11 years and 5 months old".
Sample Input 1:
I am 5 years and 11 months old
Sample Output 1:
I am 11 years and 5 months old
Sample Input 2:
I am -5 years and 11.0 old
Sample Output 2:
Explain static variable, object variable, instance variable with example