import java.io.File;
import java.io.FileNotFoundException;
import java.util.*;
public class fileread{
public class MyClass
{
public int BS;
public double instate_cost,
outofstate_cost, retention;
public String name;
}
static Scanner console = new
Scanner(System.in);
public static void main(String[] args) throws
FileNotFoundException {
Scanner reader = new
Scanner(new File("filename.txt"));
MyClass []
array;
array = new MyClass[10];
for(int
i=0;i<10;i++)
{
array[i]= new
fileread(). new MyClass();
}
int i = 0;
double
temp,temp2;
//double instate_cost,
outofstate_cost, retention, high_instate_cost,
low_instate_cost;
//String
instate_cost_name , outofstate_cost_name, retention_name ,
name;
//int i = 0;
while(reader.hasNext())
{
array[i].BS
= reader.nextInt();
array[i].instate_cost = reader.nextDouble();
array[i].outofstate_cost = reader.nextDouble();
array[i].retention = reader.nextDouble();
array[i].name = reader.nextLine();
//System.out.println(array[i].name);
i++;
}
temp = -1.0;
temp2 = 2;
double low_instate =
1000000,high_instate =-1;
String ans=" ",ans2="
",ans3=" ",ans4=" ";
for(int
j=0;j<i;j++) // here i is basically the size of the
array of the MyClass
{
if(array[j].BS == 1)
{
if(array[j].retention > temp)
{
temp =
array[j].retention;
ans = array[j].name;
}
if(array[j].retention < temp2)
{
temp2 =
array[j].retention;
ans2 = array[j].name;
}
if(array[j].instate_cost >
high_instate)
{
high_instate =
array[j].instate_cost;
ans3 = array[j].name;
}
if(array[j].instate_cost < low_instate)
{
low_instate =
array[j].instate_cost;
ans4 = array[j].name;
}
}
}
System.out.print("Best Retention Rate is ");
System.out.print(" " +
temp * 100);
System.out.println(" " +
ans);
System.out.print("Worst
Retention Rate is ");
System.out.print(temp2 *
100);
System.out.println(" " +
ans2);
System.out.print("High
instate cost is ");
System.out.print(high_instate);
System.out.println(" " +
ans3);
System.out.print("Low
instate cost is ");
System.out.print(" " +
low_instate);
System.out.println(" " +
ans4);
}
}
Use Java programing Write a program to display information about schools in North Carolina that offer...