OK so this is my first post here. (Be kind to me :)) I'm like two weeks old to java and wanted to create an app that can do the jobs of a total, average and average grader. My question here is. How can I return to a specific line of code after one operation has ended Eg: I want the code to runString menu1="Input the number of the operation you desire "; after the total or average has been found. Thanks in advance
import java.util.Scanner;
public class grader
{
public static void main (String args[])
{
Scanner input=new Scanner(System.in);
System.out.println ("Input your Chemistry marks");
float a= input.nextFloat();
System.out.println ("Input your Biology marks");
float b= input.nextFloat();
System.out.println ("Input your Physics marks");
float c= input.nextFloat();
String menu1="Input the number of the operation you desire ";
String op1="1. Total ";
String op2="2. Average ";
String op3="3. Grade ";
String op4="4. Exit ";
System.out.println (menu1+op1+op2+op3+op4);
Scanner menuselect=new Scanner(System.in);
int option= input.nextInt();
float tot=(a+b+c);
float avg=((a+b+c)/3);
if (option==1)
System.out.println ("Your total is "+tot);
else if (option==2)
System.out.println ("Your average is "+avg);
else if (option==3)
if (avg<0.0)
System.out.println ("Please input proper data");
else if (avg<=49.9)
System.out.println ("Fail");
else if (avg<=69.9)
System.out.println ("Pass");
else if (avg<=100.0)
System.out.println ("Excellent");
else
System.out.println ("Please input proper data");
}
}