[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Java Help

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 6
Thread images: 1

File: Hisoka Face When.png (179KB, 426x422px) Image search: [Google]
Hisoka Face When.png
179KB, 426x422px
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
Thread posts: 6
Thread images: 1


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.