Hi I need help its actually working fine but i don't know how to put a control structure in knowing whether the input is wrong, example when i instruct user to input number it must be less than 100 if not error will show up that is only the last thing i need to finish my program thanks
package com.grade.domain;
import java.util.*;
public class Final {
static Scanner console = new Scanner(System.in);
Final(double midterm) {
int q1 , q2 , q3, q4, ass1, ass2,finalGrade;
double totalQuiz, exam, totalAss, MG, TFG;
MG = midterm;
System.out.println(" Finals ");
System.out.print("Enter Your Quiz Number 1 : [average] ");
q1 = console.nextInt();
System.out.print("Enter Your Quiz Number 2 : [average] ");
q2 = console.nextInt();
System.out.print("Enter Your Quiz Number 3 : [average] ");
q3 = console.nextInt();
System.out.print("Enter Your Quiz Number 4 : [average] ");
q4 = console.nextInt();
totalQuiz = (q1 + q2 + q3 + q4)/4 * .4;
System.out.print("Enter Assignment Number 1: [average] ");
ass1 = console.nextInt();
System.out.print("Enter Assignment Number 2: [average] ");
ass2 = console.nextInt();
totalAss = (ass1 + ass2)/2 *.2;
System.out.print("Enter Your Final Exam : [average] ");
exam = console.nextInt();
exam = exam * .4;
TFG = totalQuiz + totalAss + exam;
finalGrade = (int)(MG/3) + (int)(2*TFG/3);
if (finalGrade >= 98 && finalGrade <=100)
System.out.println("Your Final Grade is : 1.00");
else if(finalGrade >= 95 && finalGrade <= 97)
System.out.println("Your Final Grade is : 1.25");
else if (finalGrade >= 92 && finalGrade <= 94)
System.out.println("Your Final Grade is : 1.50");
else if (finalGrade >= 89 && finalGrade <= 91)
System.out.println("Your Final Grade is : 1.75");
else if (finalGrade >= 86 && finalGrade <= 88)
System.out.println("Your Final Grade is : 2.00");
else if (finalGrade >= 83 && finalGrade <= 85)
System.out.println("Your Final Grade is : 2.25");
else if (finalGrade >= 80 && finalGrade <= 82)
System.out.println("Your Final Grade is : 2.50");
else if (finalGrade >= 77 && finalGrade <= 79)
System.out.println("Your Final Grade is : 2.75");
else if (finalGrade >= 75 && finalGrade <= 76)
System.out.println("Your Final Grade is : 3.00");
else if (finalGrade >= 70 && finalGrade <= 74)
System.out.println("Your Final Grade is : 4.00");
else if (finalGrade < 70)
System.out.println("Your Final Grade is : 5.00");
}
}