I'm currently in my second year of college. I'm finding the year very hard and don't see myself passing. But any way. I'm currently working on a Java project. The project is based on the National Car test (NCT).
Basically what I want to do is have a choice of numbers to carry out a full test or a retest. If the user selects a full test I then want to go to the fullTest class and carry out some question starting with personal information, then car details then car test question. E.g Oil level ok? Y/N
What I want to know is how do I go to the fulltest class run through the code and then ether display the results from fulltest class of return the result to mainNct.
package Nct;
import java.util.Scanner;
public class MainNCT
{
public static int choice = -1;
public static void main( String[] args)
{
Scanner Console = new Scanner(System.in);
System.out.println("Menu\n\t1. Full Test\n\t2. Re-test\n\t0. Exit\n");
System.out.print("Enter a number: ");
choice = Console.nextInt();
switch(choice)
{
case 1:
//Go to fulltest class
break;
case 2:
//Go to retest class
break;
case 0:
System.exit(0);
break;
default:
System.out.println("Invalid number entered");
} // switch
}
}
And
package Nct;
import java.util.Scanner;
public class FullTest extends MainNCT {
int wheelAliResult = 0;
String wheelResult;
public FullTest() {
Scanner Console = new Scanner(System.in);
//Questions here
System.out.print("Wheel alingment (%)? ");
wheelAliResult = Console.nextInt();
if(wheelAliResult < 0 || wheelAliResult > 6)
{
wheelResult = "Fail";
}
else
{
wheelResult = "Pass";
}
}
}