Home > Back-end >  Java assignment after the output is zero.
Java assignment after the output is zero.

Time:05-20

import java.util.Scanner;

The class pro {
String name;
Int arrTime;//arrival time
Int workTime.//run time
Double startTime.//start the service time
Double finshTime;//end time
Double cyclingTime;//turnaround time
Double weightTime;//weighted turnaround time
Boolean finish;
Public pro () {}
Public pro (String name, int the aT, int wT) {
This. Name=name;
Enclosing arrTime=aT;
Enclosing workTime=wT;
Finish=false;
}
}

Public class ProcsssClass {


Public static void main (String [] args) {
//TODO Auto - generated method stub

Pro [] pro1=new pro [5];
Scanner scan=new Scanner (System. In);
System. The out. Print (" please enter the time of arrival: ");
for(int i=0; I<5; I++) {
Pro1 [I]=new pro ();
Pro1 [I] arrTime=scan. NextInt ();

}
System. The out. Print (" please enter the service time: ");
for(int i=0; I<5; I++) {
Pro1 [I]=new pro ();
Pro1 [I] workTime=scan. NextInt ();

}
for(int i=0; I<5; I++) {
System. The out. Print (pro1 [I] arrTime + "");

}




}



}

CodePudding user response:

Online, how to change?

CodePudding user response:

for(int i=0; I<5; I++) {
Pro1 [I]=new pro ();
Pro1 [I] arrTime=scan. NextInt ();

} -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- has given new pro pro1 the array elements of the assignment ()
System. The out. Print (" please enter the service time: ");
for(int i=0; I<5; I++) {
Pro1 [I]=new pro (); -- -- -- -- -- -- -- -- -- -- -- -- -- -- delete this line can
Pro1 [I] workTime=scan. NextInt ();

} -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - and give pro1 the array element to assign new pro (), so lead to arrTime no value
for(int i=0; I<5; I++) {
System. The out. Print (pro1 [I] arrTime + "");

}
  • Related