Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help ASAP You will ask the user to enter the course dept, course num and course name. From there, you will ask the user

Please help ASAP

You will ask the user to enter the course dept, course num and

course name. From there, you will ask the user to enter the name of the

assignment. After asking the user to enter the name of the assignment, then you

will ask the user to enter points possible of the assignment. From there, you will

go ahead and enter the number of students that will be scored. Then, you will

create a dynamic array to inject the number of elements that will be used to

record the scores by using this code: int *arr = new int(n); Then, using a loop, you

will entered the score for each student, which the loop should go on for the

specified number of times as you have mentioned in the previous question. From

there, you will create a function that will be used to sort the scores in numerical

order in ascending format by using Recursive Bubble Sort. In that function, you

will make it a recursive function, where the function needs to be called for several

times until all elements of the array are sorted in alphabetical order.

Bubble Sort is the simplest sorting algorithm that works by repeatedly swapping

the adjacent elements if they are in wrong order.

Example:

First Pass:

( 5 1 4 2 8 ) > ( 1 5 4 2 8 ), Here, algorithm compares the first two elements, and

swaps since 5 > 1.

( 1 5 4 2 8 ) > ( 1 4 5 2 8 ), Swap since 5 > 4

( 1 4 5 2 8 ) > ( 1 4 2 5 8 ), Swap since 5 > 2

( 1 4 2 5 8 ) > ( 1 4 2 5 8 ), Now, since these elements are already in order (8 > 5),

algorithm does not swap them.

Second Pass:

( 1 4 2 5 8 ) > ( 1 4 2 5 8 )

( 1 4 2 5 8 ) > ( 1 2 4 5 8 ), Swap since 4 > 2

( 1 2 4 5 8 ) > ( 1 2 4 5 8 )

( 1 2 4 5 8 ) > ( 1 2 4 5 8 )

Now, the array is already sorted, but our algorithm does not know if it is

completed. The algorithm needs one whole pass without any swap to know it is

sorted.

Third Pass:

( 1 2 4 5 8 ) > ( 1 2 4 5 8 )

( 1 2 4 5 8 ) > ( 1 2 4 5 8 )

( 1 2 4 5 8 ) > ( 1 2 4 5 8 )

( 1 2 4 5 8 ) > ( 1 2 4 5 8 )

Following is iterative Bubble sort algorithm :

// Iterative Bubble Sort bubbleSort(arr[], n) { for (i = 0; i < n-1; i++) // Last i elements are already in place for (j = 0; j < n-i-1; j++) { if(arr[j] > arr[j+1]) swap(arr[j], arr[j+1]); } }

Sample Output:

Welcome to Grade Calculator!

Enter the course dept: ______________

Enter the course number:

____________

Enter the course name: _______________

Enter the number of students that will be scored: ______________

Enter points possible: _______________

//Based on the number of students that was entered, you will run the loop for

that amount of times

Enter the score: ________________

//After the loop, you will take the element of the array, pass it to the function

to do Recursive Sort Algorithm as a recursive function

//Calculate the average score using the following formula

double average = ((total score, add all elements of array together)/(number of

students * points possible)) * 100

//Calculate the lowest score

//Calculate the highest score

Course: CMPS 367: Object Oriented Language C++

Scores: 10 20 30 40 50 60 70 75 80 85 90 95 100

Average: _____%

Lowest Score: 10

Highest Score: 100

Thank you for using the grade calculator!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database 11g SQL

Authors: Jason Price

1st Edition

0071498508, 978-0071498500

More Books

Students also viewed these Databases questions

Question

What is cultural tourism and why is it growing?

Answered: 1 week ago