I have had to write a java program that takes in some user details and then performs some calculations. I have included a check in the program to ensure that the user has entered details correctly. I have no problem getting the program to perform the calculations if they are correct but I can't figure out how to get the program to restart so that the user re-enters values if they are not correct. I have copied the code below:
System.out.println("Is this correct? (Y/N)");//Validation and check of data entered
correctValues=sc.next() .charAt(0);
if (correctValues=='Y'|| correctValues=='y')
System.out.println("Thank you. You have achieved the following grade:" +finalGrade());
if (correctValues=='N'||correctValues=='n')
{System.out.print("Please re-run program");}
So where I have added "Please re-run program" I would really like this no answer to send the user back to the first method in the program. I suspect this is fairly easy to do but I don't know how. Any help would be very gratefully received.