Java Object InputOutput Streams For this exercise you will u
Java Object Input/Output Streams
For this exercise, you will use JavaFX to create a small order form GUI for T-Shirt. The information entered into the form must be \'preserved\', that is, after you save it, and restart the app, the form should display with the information entered previously. To do this, you will save the information in an entity object, and serialize it. When the app starts, if will de-serialize the object and use it to populate the form.
Details
The first step is to create the entity object. An entity object is just a plain old java class -- nothing fancy. It has some attributes, and the appropriate getters/setters. Here, we have a TShirt class with 3 attributes: size, text, and gift. We want this object to be serializable, so make sure it implements the required interface.
Next, use your new JavaFX knowledge to create the following GUI. The radio buttons should be grouped so only one is selected at any one time.
When the save button is selected, you will read the data from the form and call the setter methods on your entity object. Then, you will serialize your tshirt entity object it to the current directory.
When your JavaFX app starts, it needs to deserialize the TShirt entity object and call the getter methods to set the form controls. Keep in mind that the entity object may not exist ( which is certainly true the first time). In other words, make sure that you have de-serialized a object before you use it to populate the GUI controls.
Solution
int main()
{
//create three student records
STUDENT_TYPE student[3];
int best_student, i;
double best_GPA;
for(i=0;i<3;i++)
{
cout<<\"Enter details for the student#\"<<i+1<<endl;
cout<<\"Name:\";
cin>>student[i].name;
cout<<\"ID : \";
cin>>student[i].ID;
cout<<\"GPA :\";
cin>> student[i]. GPA;
cout<<\"Major: \";
cin>>student[i].Major;
cout<<\"_____________________________________________________________\"<<endl;
}
//best student
best_GPA=-1.0;
best_student=-1;
for( i=0;i<3;i++)
{
if(student[i].GPA>best_GPA)
{
best_GPA=student[i].GPA;
best_student=i;
}
}
if (best_student!=-1)
cout<<\"Best student is \"<< student[best_student].name<<\"with GPA= \"<<best_GPA<< endl;
else
cout<<\"Highest GPA isnot distinct.No single best student could be found.\"<<endl;
//student with ID 101
for( i=0;i<3;i++ )
{
if (student[i].ID==101)
{
cout<<\"Student\"<<student[i].name<<\"has ID 101.\"<<endl;
}
}
return 0 ;
}

