I'm teaching myself Java and this is an error I've never gotten before, because it's something I thought I had mastered.
import java.util.*;
public class StudentApp {
public static void main(String[] args){
int CLTOT = 225;
int EXAMTOT = 150;
int FTOT = 100;
int LABS;
int PROJ;
Scanner s = new Scanner(System.in);
Student builder = new Student();
Student[] classScore = new Student[50];
Student.studentScores();
System.out.println("");
boolean run = true;
int counter = 0;
do{
System.out.print("Enter student's name (firstname lastname): ");
String name = s.nextLine();
System.out.println("Enter student's WID: ");
String id = s.nextLine();
System.out.println("");
System.out.println("Enter student's total for all LABS: ");
double ltot = Double.parseDouble(s.nextLine());
System.out.println("Enter student's total for all PROJECTS: ");
double ptot = Double.parseDouble(s.nextLine());
System.out.println("Enter student's total for all CODELAB: ");
double ctot = Double.parseDouble(s.nextLine());
System.out.println("Enter student's total for the 3 CLASS EXAMS: ");
double etot = Double.parseDouble(s.nextLine());
System.out.println("Enter student's total for the FINAL EXAM: ");
double ftot = Double.parseDouble(s.nextLine());
classScore[counter] = new Student(name, id, ltot, ptot, ctot, etot, ftot);
counter++;
System.out.println(counter + "Student(s) entered so far.");
System.out.println("Up to 50 students can be entered.");
System.out.println("Would you like to enter another student? ('Y' or 'N'): ");
char response = s.nextLine().charAt(0);
switch(response){
case 'Y':
case 'y':
if(counter <= 50){
run = true;
}
else{
run = false;
}
break;
case 'N':
case 'n':
run = false;
break;
}
}while(run);
}
}
I'm getting an error at my do-while, after the first print. The scanner isn't finding a line and idk why.
Please use code tags.
>>59683508
What exactly did you enter as input?
Also, learn to comment your code.
>>59683508
>>59683725
Also, sharing your stacktrace would be a good idea.
I'm not going to help until you use code tags and tell me what the error actually is.
>>59683508
Give it back trayvon