+ 1
Can anyone help me in this project It doesn't give output either some errors , I am a beginner in java
nested if else statement https://code.sololearn.com/cnn5A5R9uQ8Z/?ref=app https://code.sololearn.com/cnn5A5R9uQ8Z/?ref=app
4 odpowiedzi
+ 2
Line 7:
You didn't define what "average" was.
Line 13:
You didn't define what type the variable "Score" was (I'd assume float).
Line 15:
See line 7; fix that, and this line should work.
The if statement:
There is no semicolon after the the ending parenthesis.
The "elseif" statements:
The statement is the "else if" statement. It has a space. Also, there are no semicolons after the ending parenthesis.
+ 2
Can you give us the conditions of this task?
Including what @LunarCoffee said:
1. For what are a, b, c, d variables actualy? You should always use appropriate names for the variables.
2. The 'if - else if' construction is wrong.
- The first condition is always true, because if something is less or equal 100 is true, right?
- No need to check if something is less than 99 and less or equal than 96 in the same time.
+ 1
sir I change my code of what you've said now I still encounter error
+ 1
You need to learn how to write the name of variables, methods and classes.
In short:
The variable's name start with a lower case letter (never a number) and should be written by the camelCase rule and cannot contain space.
Examples for variables:
- score
- averageScore
- tentativeGrade
- averageStudentScore
Wrong:
- Score
- Average Score
- Tentative Grade
Class names starts with Upper case (no space allowed):
- Student
- HelloWorld
Try to fix that as first.
Edit:
Here is the code with some fixes:
https://code.sololearn.com/c1dPszLuuQ4C/#java
- Fixed the compilation errors
- The input (as output) is replaced with the result of the formula in the condition
The condition is still unclear for me. Maybe I'm not on the right path to solve it.