ok so if i get all that going it works but if i enter 5 scores i have to click 5 times and i see my letter grades appear 1 by 1 and the sum and average also go up 1 at a time.
my loop is not looping back before displaying the final joptionpane.
i'm not sure if i need to change the for loop or if i need a return statement. i tried using a return statement a couple different ways and either got an error or the program just doesn't run (visually) and says build complete.
Noorul Hameed wrote:Hi, The problem is to close the for loop befor last statement, JOptionPane...It can not be inside the loop. It is after for loop completed.
Anther thing about else‑if. If your boundary value is included in the upper category, start small. The boundary value for a C is 70, and 70 is included in the C grade, not the D grade. If you start small, you don't need >=, but <. The >= and <= operators aren't actually bad, but < and > are easier to understand.When you write that sort of thing always keep the terms in order, ascending or descending. You might so well to precede that if with something likeRemember it is usually not a good idea to write lots of number literals like that, but that is a different problem.
Carey Brown wrote:Not that by using "else if" you no longer need the "&&" component because that is taken care of by the order that these comparisons are made.
Campbell Ritchie wrote:
Carey Brown wrote:
Hi Mr. Rob
This task has already been explored by Mr Cambell Richie. Please have a look at quote here.
something likeRemember it is usually not a good idea to write lots of number literals like that, but that is a different problem.
Rob Frank wrote:I'm trying to do this
it obviously doesn't work.
Of course they can. But I can see problems lining up the grades and the numbers in the array.
Rob Frank wrote:i'm also wondering if count A , B, C, D and F can be made into an array. . . .
Rob Frank wrote:(...) i can see how only knowing how to do a few things with java can really complicate the code. not sure learning how to complicate the code should be in a beginning java class. anyways
permaculture is a more symbiotic relationship with nature so I can be even lazier. Read tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your databasehttps://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database