I have a recipe class which has a constructor, the constructor takes in 7 parameters =
RecipeName,AuthorName,Ingredients,Ingredientamounts,rating,servingSize,Instructions
I'm trying to set those values using the scanner, but I don't know how to make it work since I have the scanner method inside of the Recipe class.
So it looks kind of like this in pseudocode .
Please take into count, that I will have a an array of this class because there will be multiple recipes the user will select with a JFileChooser. There will also be a JFrame but that will be easier.
public class Recipe
{
String nameOfFileandDirectory = "User sets value";
File file = new File( nameOfFileandDirectory);
Scanner scanner = new Scanner(file);
String scannerLine = scanner.nextLine();
String int double etc; // these are all of the variables the scanner will get
public Recipe(etc)
{
etc = etc; // These will be obviously more variables, but for simplicity am only getting one;
}
}