Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Understanding Oracle APEX 5 Application Development

Authors: Edward Sciore

2nd Edition

1484209893, 9781484209899

More Books

Students also viewed these Databases questions