Question: Convert This C++ code to Java: /Header file section #include #include using namespace std; //struct type struct studentType { int studentID; char studentName[10]; float gpa;

Convert This C++ code to Java:

/Header file section #include #include using namespace std; //struct type struct studentType { int studentID; char studentName[10]; float gpa; };

//main method int main() { //Declare variable int size=0;

//Read input file data ifstream input; input.open("input.txt"); //Create struct's object studentType studData[20]; //input records into a record structure while(!input.eof()) { input>>studData[size].studentName>>studData[size].studentID>>studData[size].gpa; size++; } //sort them in ascending order using Student ID as a key. for(int i = 0; i < size; i++) { for (int j=i+1; j < size; j++) { if (studData[j].studentID < studData[i].studentID) { studentType temp = studData[j]; studData[j] = studData[i]; studData[i] = temp; } } } //Display the sorted output. for(int i=0; i { cout< } //Pause the system for a while system("PAUSE"); return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!