All things are lawful, but not all things are profitable.
Doug Woodin wrote:
This is the assignment here and I am kind of shaky with if statements and such.
Doug Woodin wrote:
In the GradeCalculator.java program the user clicks the Enter button.
The first input is a JOptionPane that asks the user, “Number of score to be entered?”
scoreAmount = JOptionPane.showInputDialog("Number of scores to be entered?");
numberOfScores = Integer.parseInt(scoreAmount);
All things are lawful, but not all things are profitable.
All things are lawful, but not all things are profitable.
Pass the value returned from the option pane directly to parseInt withoutDoug Woodin wrote:. . .
GradeCalculator.java:161: error: incompatible types: String cannot be converted to int
. . .
All things are lawful, but not all things are profitable.
All things are lawful, but not all things are profitable.
Doug Woodin wrote:I did try to declare it as a double and it said a double cannot be a string also.
Doug Woodin wrote:I did try to declare it as a double and it said a double cannot be a string also.
And I haven't a clue how to make the dialog box incorporate additional inputs; the first is just the number of grades, then it is supposed to create a new input for the number of grades inputted.
All things are lawful, but not all things are profitable.
All things are lawful, but not all things are profitable.
Campbell Ritchie wrote:Have you tried to compile that sort of code? Have a look at the Java™ Tutorials about arrays and see what the square brackets mean.
Doug Woodin wrote:
To perform this, would it not be something like...
If grade[i] = "A"; //will be >89
if grade[i] = "B"; //will be >87 < 80 for example?
I'm understanding a little bit the premise, but I'm still a bit confused.
if grade[i] (which is the median of the grade totals; if i enter 5 grades to evaluate in the dialog, and all 5 grades are for example 89, so you have 89 89 89 89 89 with an average of 89, then [i] would produce a "A" result. )
Is [i] something I need to declare?
and numberOfGrades is just the first part of the whole.
Is what you described just for the amount of grades before the average is calculated?
All things are lawful, but not all things are profitable.
Are you here to take over the surface world? Because this tiny ad will stop you!
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|