dimanche 17 mai 2020

i need to pass String argument in one method to another method?

so i need to to pass the String array argument in the AddNewStudent method to ADDNewSMark method. but compiler gives me an error in where i called the AddNewSMarks(SID); line in AddNewStudent method. it show me error as,

method AddNewSMarks in class Example cannot be applied to given types; AddNewSMarks(); required: String[] found: no arguments reason: actual and formal argument lists differ in length 1 error

public static void AddNewSMarks(String [] SID){
Scanner input=new Scanner(System.in);

AddNewStudent();

double [] fundemental=new double[15];
double [] database= new double[15];


for (int i = 0; i < 15;i++)
{
System.out.print("Programming Fundemantal Marks : ");
double fMarks=input.nextDouble();
if(fMarks<0 && fMarks>100){
System.out.println("Invalid marks, please enter correct marks.");
break;
}else{
fundemental[i]=fMarks;
}
}
for (int j = 0; j< 15; j++)
{
System.out.print("Database Management System Marks : ");
double dMarks=input.nextDouble();

if(dMarks<0 && dMarks>100){
System.out.println("Invalid Marks, please enter coorect marks.");
break;
}else{
database[j]=dMarks;
}

}

}

Aucun commentaire:

Enregistrer un commentaire