I wrote the code below for my homework. It should ask the user to calculate two things and it should stop when null is entered. It works, except from one thing and that is that it should show the same question again if you give the wrong answer. What do I have to do to show the same question again when I enter for example 24 to question 1?
----------------------------------------------------------
import java.util.Scanner; public class SmallMathematicsApplication{ public static void main(String[] args) { int som1; int som2; int reportError; Scanner reader = new Scanner(System.in); System.out.print("5+20? "); som1 = reader.nextInt(); if (som1 == 25) { System.out.println("good job");} else if (som1 == 0) { System.out.println("you stopped the program by entering null");System.exit(-1);} else { System.out.println("try it again");} System.out.print("5+26? "); som2 = reader.nextInt(); if (som2 == 31) { System.out.println("good job, you finished the exercise");} else if (som2 == 0) { System.out.println("you stopped the program by entering null");System.exit(-1);} else { System.out.println("try it again");} }}