In C++ write a class. The requirements for the class are define as followings:
ANSWER :
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
class StudentQuickSorter
{
public:
void PrintRecords(int arr[], int n) //method to print
all the records
{
cout<<"PRINTING THE RECORDS:"<<endl;
for(int i=0;i<n;i++)
{
cout<<arr[i]<<endl;
}
}
void swap(int *n1, int *n2) // method to swap two
numbers, it is used in quick sort implementation
{
int temp;
temp = *n1;
*n1 = *n2;
*n2 = temp;
}
int partition_function(int arr[], int l, int
h) // method implementing partition
function
{
int pivot, index, i;
index = l;
pivot = h;
for(i=l; i < h; i++)
{
if(arr[i] < arr[pivot])
{
swap(&arr[i], &arr[index]);
index++;
}
}
swap(&arr[pivot], &arr[index]);
return index;
}
int pivot_partition_function(int arr[], int l, int
h) //method to genereate random pivot
partition
{
int pvt, n, temp;
n = rand();
pvt = l + n%(h-l+1);
swap(&arr[h], &arr[pvt]);
return partition_function(arr, l, h);
}
int Quick_sort_function(int arr[], int l, int
h) // quicksort function
implementation
{
int pindex;
if(l < h)
{
pindex = pivot_partition_function(arr, l, h); //finding
partition for divding input array
Quick_sort_function(arr, l, pindex-1); // dividing input
array into parts to get efficient tiem complexity
Quick_sort_function(arr, pindex+1, h);
}
return 0;
}
void Sort(int arr[],int n) // Sort method to sort the
records using quicksort algorithm
{
Quick_sort_function(arr,0,n-1);
cout<<"RECORDS SORTED"<<endl;
}
};
int main()
{
int n;
cout<<"Enter the number of students record to be added in the
array: "<<endl;
cin>>n;
cout<<"Enter "<<n<<" records now:
"<<endl;
int arr[n];
for(int i=0;i<n;i++)
cin>>arr[i];
StudentQuickSorter object;
object.Sort(arr,n);
object.PrintRecords(arr,n);
return 0;
}
CODE IMAGE:


In C++ write a class. The requirements for the class are define as followings: Class StudentMergeSorter...
In C++ write a class. The requirements for the class are define as followings: Class StudentQuickSorter – This class will have the following methods with their signatures as listed below: Sort() This method will have two parameters. The first parameter will be an array of Student records to be sorted. The second parameter will be the number of Student records in the array. PrintRecords() This method will have two parameters. The first parameter will be an...
In C++ write a class. The requirements for the class are define as followings: Class StudentBubbleSorter – This class will have the following methods with their signatures as listed below: Sort() – This method will receive an array of Student records to be sorted. It will sort the records by Student ID(s). It will also return the sorted array of Student records. PrintRecords() – This method will receive an array of Student records. It will print out the information of...
Implement a software program in C++ t stores and searches the Student records using double-hashing algorithm. Double hashing uses the idea of applying a second hash function to key when a collision occurs. The software program will be based on the following requirements: Development Environment: If the software program is written in C++, its project must be created using Microsoft Visual Studio 2017. If the software program is written in Java, its project must be created using NetBeans v8.2. Algorithm: If...
Write a C++ program that asks user number of students in a class and their names. Number of students are limited to 100 maximum. Then, it will ask for 3 test scores of each student. The program will calculate the average of test scores for each student and display with their names. Then, it will sort the averages in descending order and display the sorted list with students’ names and ranking. Follow the Steps Below Save the project as A4_StudentRanking_yourname....
/* Implementation of the main() method of the program. */ #include <iostream> #include <string> #include <vector> #include <algorithm> using namespace std; class Student { public: // default constructor Student() { studentID = 0; studentFirst = "First"; studentMiddle = "Middle"; studentLast = "Last"; } void SetStudentID(int number) { studentID = number; } void SetStudentFirst(string name) { studentFirst = name; } void SetStudentMiddle(string name) { studentMiddle =...
( Object array + input) Write a Java program to meet the following requirements: 1. Define a class called Student which contains: 1.1 data fields: a. An integer data field contains student id b. Two String data fields named firstname and lastname c. A String data field contains student’s email address 1.2 methods: a. A no-arg constructor that will create a default student object. b. A constructor that creates a student with the specified student id, firstname, lastname and email_address...
The object class should be a Student with the following attributes: id: integer first name: String last name: String write the accessors, mutators, constructor, and toString(). In your main test class you will write your main method and do the following things: Create an array of Student objects with at least 5 students in your array. Write a sort method that must be your original work and included in the main class. The sort method will sort based on student...
Create a java class for an object called Student which contains the following private attributes: a given name (String), a surname (family name) (String), a student ID number (an 8 digit number, String or int) which does not begin with 0. There should be a constructor that accepts two name parameters (given and family names) and an overloaded constructor accepting two name parameters and a student number. The constructor taking two parameters should assign a random number of 8 digits....
Please help. I need a very simple code. For a CS 1 class. Write a program in Java and run it in BlueJ according to the following specifications: The program reads a text file with student records (first name, last name and grade). Then it prompts the user to enter a command, executes the command and loops. The commands are the following: "printall" - prints all student records (first name, last name, grade). "firstname name" - prints all students with...
In C++ format: Define a function called DisplayMax. It will have 3 parameters of two different types of known parameter lists which are either void DisplayMax(string idI, double value[], int size) or void DisplayMax(int idn, short value几int size). The first and second parameters are parallel arrays. (Parallel Arrays are two arrays whose data is related by a common index. For example: with the string array and double array, index 5 of the string array would have some name, and index...