Hi I'm very new to Java and am currently in a course learning it. I've created the program below, it is an exercise where the user can input two fractions with whole numbers and they will be add together. My final step is to create a method that will add the two inputs into a proper fraction however when I go to start creating the method I cannot for the life of me figure out how to start calling the individual numbers from the two inputs. It seems like it should be really obvious but I'm at a loss. Any help would be greatly appreciated.import java.util.Scanner;
//Begin Code
class Mix_JW extends Fraction_JW{
public Mix_JW(int n, int m) {super(n,m); }
public String displayMix() {
String str="";
if (first < second) str=first+"/"+second;
else str= first/second +" "+ first%second+"/"+second;
return str;
}//display
public static String get (){
Scanner scan = new Scanner (System.in);
System.out.print("Please enter whole number and fraction as such 1 2/3:");
String userInput = scan.nextLine();
userInput =userInput.trim();
System.out.println("Input is: "+userInput);
return (userInput);
} //get
public static String get2 (){
Scanner scan = new Scanner (System.in);
System.out.print("Please enter whole number and fraction as such 1 2/3:");
String userInput2 = scan.nextLine();
userInput2 =userInput2.trim();
System.out.println("Input is: "+userInput2);
return (userInput2);
}//get2
public static int[] parse (String userInput){
int pos = userInput.indexOf(" ");
String sNum=userInput.substring(0,pos);
int iNum = Integer.parseInt(sNum);//first integer
String sNum2=userInput.substring(pos+1);
pos= sNum2.indexOf("/");
String sTop=sNum2.substring(0,pos);
int iTop = Integer.parseInt(sTop);//second integer
String sBot=sNum2.substring(pos+1);
int iBot = Integer.parseInt(sBot);//third integer
System.out.println("Triple =: "+iNum+"|"+iTop+"|"+iBot);
int[] sA = {iNum,iTop,iBot};
return (sA);
} //parse
public static void main(String[] args) {
String userInput = Mix_JW.get();
int[] iA= parse(userInput);
Mix_JW first=new Mix_JW(iA[0]*iA[2]+iA[1],iA[2]);
System.out.println("First Measurement= "+first.displayMix());
String userInput2 = Mix_JW.get2();
int[] iB= parse(userInput2);
Mix_JW second=new Mix_JW(iB[0]*iB[2]+iB[1],iB[2]);
System.out.println("Second Measurement= "+second.displayMix());
}
//main
}//class
//End code