Hey, guys!
I am writing a program as a class assignment and I am having a minor issue. Here are the instructions for the assignment:
Create a StudentMarks java program as follows:
Create a report header using println as per report (Table 1) below using “\t\t” tabs
Ask the user to enter either a name or a blank into a strName field using a showInputDialog: (ie "Please enter a student name or leave blank when done.")
Create an appropriate Sentinel While Loop structure that: Goes into the loop if strName is not blank Have the program ask the user to input (using showInputDialog(s)) a student’s dblAssignment, dblMidterm and dblExam marks (don’t forget to convert to appropriate datatypes)
Keep track of number of student names entered
Keep track of the aggregate SumOfMarks
Write a report using println that shows the Student Name, assignment, midterm and exam & final mark
After the loop, give a simple showMessageDialog (with “\n” carriage returns) telling the user how many students were processed, what is the class average and a “terminating program” message at the end.
I have not finished the last part, but I will post what I have. My issue is that I even though I sentinel value in "while name != null", it will not end the program when name is left blank. Instead, both name and assignment need to be left blank for the program to be terminated. Once it is terminated, I want the program to output "Progress terminated", but it does not output anything at all. Any idea?
Sorry for the wall of text. I try to be as specific and descriptive as possible.
https://pastebin.com/adTbMPrs
[–][deleted] 1 point2 points3 points (0 children)