RUVIDEO
Поделитесь видео 🙏

Using Python to Solve Java Problems | Chapter 1 Exercise 18 - Compute Student Score & Average Score

📁 Обучение 👁️ 16 📅 02.12.2023

Our code today will process a text file containing student names and a test score. When the code is run, we shall see the output as follows: the Average test score of the class, Students with score below average test score, the highest score, and the students with score same as the highest test score.

Chapter One Exercise 18

You are given a list of students’ names and their test scores. Design an algorithm that does the following:
a. Calculates the average test scores.
b. Determines and prints the names of all the students whose test score is below the average test score.
c. Determines the highest test score.
d. Prints the names of all the students whose test score is the same as the highest test score.

(You must divide this problem into subproblems as follows: The first subproblem determines the average test score. The second subproblem determines and prints the names of all the students whose test score is below the average test score. The third subproblem determines the highest test score. The fourth subproblem prints the names of all the students whose test score is the same as the highest test score. The main algorithm combines the solutions of the subproblems.)

Problem Redesign (Stuff not explicitly mentioned in the original problem)

1. Data will be stored in a text file called data.in and will be read by the program.
Algorithm and pseudo-code
Steps to take:

1. Open data text file for processing in read-only mode.
Save the data read into the memory for faster access

2. Calculate the average test scores by following the steps below:

a. Get all student scores and sum them up
b. Get total number of students
c. Compute average test score by using the following formula:

average test score = sum of all students' scores / number of students

3. Repeat the following steps *to print the names of all the students whose test scores are below the average test score.

a. Get student score and student name.
b. If student score is less than average test score then
print student name and the test score
4. To determine the highest test score follow the following steps

a. Get score of first student and set it as the highest score.
b. Repeat the following steps until all student scores have been acquired.
b1. Get next student score and compare with the highest test score.
b2. If student score is greater than highest score then
highest test score = student score

5. To print the names of all the students whose test score is the same as the highest test score, follow the steps below

a. Get student test score and name.
b. Repeat the following steps until all students have been processed
b1. if student score is equal to highest score, then
print student name

6. Done.

Music Credit: See You On The Otherside - The 126ers
https://www.youtube.com/channel/UCep47rkC_STH4BdGVUTeMnw

#python #intermediate #programming #java #computerprogramming
#calculatestudentscores

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Using Python to Solve Java Problems | Chapter 1 Exercise 18 - Compute Student Score & Average Score», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.