Hi,
im trying to construct the main program class in a java program and it has a command line interface, but im having trouble as i have to get the user to specify the number of machines they want at the command line, i've done this, but now i need this to be passed to a package which contains the machine class, so that the method addMachine is repeated the number of times the user specified(i.e. repeat addMachine method 4 times if user types in 4). This is the code i have so far for this bit:
import java.io.*;
public class CommandLineInterface
{
public static InputStreamReader input = new InputStreamReader(System.in);
public static BufferedReader keyboardInput = new BufferedReader(input);
int NumberOfProcessMachines;
System.out.print("How many processing machines do you require ?"
NumberOfProcessMachines = new Integer (keyboardInput.readLine()).intValue();
plant.addMachine("Processing", 20, 60, (float)1/100);
N.B. normally i'd repeat the line
plant.addMachine("Processing", 20, 60, (float)1/100);
as many times as i need, but this isn't good programming, , could anyone please give me any suggestions on how to do this.Thankyou
im trying to construct the main program class in a java program and it has a command line interface, but im having trouble as i have to get the user to specify the number of machines they want at the command line, i've done this, but now i need this to be passed to a package which contains the machine class, so that the method addMachine is repeated the number of times the user specified(i.e. repeat addMachine method 4 times if user types in 4). This is the code i have so far for this bit:
import java.io.*;
public class CommandLineInterface
{
public static InputStreamReader input = new InputStreamReader(System.in);
public static BufferedReader keyboardInput = new BufferedReader(input);
int NumberOfProcessMachines;
System.out.print("How many processing machines do you require ?"
NumberOfProcessMachines = new Integer (keyboardInput.readLine()).intValue();
plant.addMachine("Processing", 20, 60, (float)1/100);
N.B. normally i'd repeat the line
plant.addMachine("Processing", 20, 60, (float)1/100);
as many times as i need, but this isn't good programming, , could anyone please give me any suggestions on how to do this.Thankyou