I have an assignment like this:
Write a complete program called ExamResult with the behavior shown below. Read user input for a student’s internal test score and final exam score.
An internal test score below 20 will cause the student to be failed; final examscore below 40 will also cause the student to be failed.
Otherwise the student has passed.
Semester Examination Results!
What is your internal test score? 21
What is your final exam score? 69
You have passed!
So far I've figured out that using an if statement with a scanner for input would be appropriate. For now this is my code (I do have class, import java util and main methode above. I choose not to include it here)
System.out.println("Semester Examination Results!");
System.out.println("What is your internal test score?");
//input
//calculate input
//does input pass the if test?
//output passed/failed
int score1 = scanner.nextLine();
int score2 = scanner.nextLine();
if (int score1 < 20; || score2 < 40;)
{
System.out.println("You have failed");
}
else
{
System.out.println("You have passed");
}
What I'm unsure about is how to use input for calculation?
Aucun commentaire:
Enregistrer un commentaire