Final answer:
To write a program that performs the given tasks, you will need to use a programming language such as Python. You can create functions to handle each step of the process, such as getting the student number, calculating the summation, generating random numbers, and sorting the list. Finally, you can print the sorted list of numbers.
Step-by-step explanation:
To write a program that performs the given tasks, you will need to use a programming language. Here is an example of how you can implement a solution in Python:
- Create a function that takes a student number as input from the user.
- Create a second function that calculates the summation of all the numbers in the student number.
- Create a third function that generates random integer numbers between 1 and 100, as many times as the summation calculated in the previous step, and stores them in a list.
- Implement the Bubble Sort algorithm to sort the list of random numbers.
- Print the sorted list of numbers.
Here is an example implementation:
import random
def get_student_number():
student_number = int(input('Enter your student number: '))
return student_number
def calculate_sum(number):
summation = sum([int(digit) for digit in str(number)])
return summation
def generate_random_numbers(summation):
random_numbers = [random.randint(1, 100) for _ in range(summation)]
return random_numbers
def bubble_sort(numbers):
n = len(numbers)
for i in range(n):
for j in range(0, n-i-1):
if numbers[j] > numbers[j+1]:
numbers[j], numbers[j+1] = numbers[j+1], numbers[j]
student_number = get_student_number()
summation = calculate_sum(student_number)
random_numbers = generate_random_numbers(summation)
bubble_sort(random_numbers)
print(random_numbers)