Beginner coder here. I'm trying to differentiate when a user inputs a value and does not input a value.
Right now the integer variable = 0 when there is no specified value input by the user.
But if the user inputs 0 as their variable, I need it to be different.
if(exam1Input == 0){
exam1Per = 0;}
if(exam2Input == 0){
exam2Per = 0;}
if(finalExamInput == 0){
finalExamPer = 0;}
if(labsInput == 0){
labsPer = 0;}
if(projectsInput == 0){
projectsPer = 0;}
if(quizzesInput == 0){
quizzesPer = 0;}
if(attendanceInput == 0){
attendancePer = 0;}
I did this multibranch if statement to covert the value of the percentage grade weights to zero if the input was zero(i.e. no input at all).
However I come across a problem of when the user inputs "0" as their actual grade. I can't let the percentage weight be 0, I still need it to be the certain grade percentage.
e.g. if their test average is 0, i still need to calculate their percentage based on the grade 0.
So how could I be more specific and able to differentiate between a missing input versus an actual input?
I want zero to be the actual grade not as a missing input.
Aucun commentaire:
Enregistrer un commentaire