Monday 15 September 2014

menu method in java -


I want to print the menu with the instructions method but the program does not execute anything. Can someone advise me how can I fix this?

The class has a manifesto in the class ..

  public class factorial {public zero instructions ({{System.out.printf ("Enter your Likes: \ n "," to calculate a factual value of integers 1. \ N "," 2. \ N "," 3 ^ e ^ x. \ N "to calculate mathematical constant e, "4. \ N"); } // end of instructions}   

And here's the main, which calls the instructions method from the Factorial class.

  import java .util.Scanner; // programmable scanner uses public class behavior {Private stationary scanner input; Public Stable Zero Main (String [] Elps) {Factorial MyFactorial = New Factorial (); Myfactorial.instructions (); }}    

You're using printf, for which the first argument is actually a Format string, will print the Next argument according to that format.

Therefore, ignoring the error of class name between factual and factorial, your code should only print option: \ n ".

Instead of using print:

  System.out.print ("Enter your choice: \ n" to calculate a factual value of an integer for 1. \ N "+" To calculate mathematical constant E 2. \ N "+" 3 ^ e ^ x. \ N "+" to eliminate .4 \ N ");   

Note that there is only one argument for this function, here it is separated by string consonance for easy readings.

No comments:

Post a Comment