0
I’m trying to make a program, which gives the grade of two tests, P1 and P2. You sum and divide by 2 to get the average. If it is larger than 6, the program returns the following sentence: Approved. If the average is less than 4, the program returns the following sentence: Flunked. Now, if the grade is between 4 and 6, the program asks for the proof of recovery (VS) grade, and if it is greater than 6, returns: Approved, or if the note is less than 6 it returns: Flunked.
I wanted to ask for help, where I got the problem wrong.
Note: I cannot use Scanner. I have to keep it like this, only I cannot run the program.
class Media {
public static double Media( float P1, float P2) {
double Media = (P1 + P2) / 2;
}
public static double VS( float nota) {
double VS = nota;
}
public static void main(String [] args) {
if (Media >= 6) {
System.out.println("Aprovado.");
}
else if (Media < 4) {
System.out.println("Reprovado.");
}
else {
if( nota >= 6) {
System.out.println("Aprovado.");
}
else {
System.out.println("Reprovado.");
}
}
}
}
How notes are passed to your program?
– Lucas Lima
Voce has two problems: 1) your program does not run; 2)vc do not read the input data at any time, as Voce intends to pass this information to your program?
– Math
Media
andVS
should return a valuedouble
, but instead you create a new variable that does nothing within the function.– Lucas Lima
if (Media >= 6) {
mean is a class, you can’t make this comparison with classes, only with variables– Math