Friday, October 8, 2021

Plus 10, 100, and 1000 Methods in Java

 Machine Problem


Create a Java program that would ask an integer from the user. This should be performed by the main method. Construct three (3) methods named showNumberPlus10(), showNumberPlus100(), and  showNumberPlus1000(). Each  methods should perform the task its name implies. Called the methods after the user input to display three (3) outputs in separate lines.

Sample  Program Output


Enter an Integer : 20

20 plus 10 is 30.

20 plus 100 is 120.

20 plus 1000 is 1020.


I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod City I also accepting computer repair, networking, and Arduino Project development at a very affordable price. My website is www.jakerpomperada.blogspot.com and www.jakerpomperada.com

If you like this video please click the LIKE button, SHARE, and SUBSCRIBE to my channel.





Program Listing



/*  plus10.java

 * 

 *  Prof. Jake Roderiguez Pomperada, MAED-IT, MIT

 *  www.jakerpomperada.com  and www.jakerpomperada.blogspot.com

 *  jakerpomperada@gmail.com

 *  Bacolod City, Negros Occidental Philippines

 * 

 * 

Machine Problem


Create a Java program that would ask an integer from the user.

This should be performed by the main method. Construct

three (3) methods named showNumberPlus10(), showNumberPlus100(),

and  showNumberPlus1000(). Each  methods should perform the task

its name implies. Called the methods after the user input to display

three (3) outputs in separate lines.


Sample  Program Output


Enter an Integer : 20

20 plus 10 is 30.

20 plus 100 is 120.

20 plus 1000 is 1020.



 */




import java.util.Scanner;


  


class plus10


{

     public  static int showNumberPlus10(int a)

    {  

        

         System.out.println("\t" + a + " plus 10  is " + (a+10) + ".");

         return 0;

    }  

   

    public  static int showNumberPlus100(int a)

    {  

        

         System.out.println("\t" +  a + " plus 100  is " + (a+100) + ".");

         return 0;

    }  

    

    public  static int showNumberPlus1000(int a)

    {  

        

         System.out.println("\t" + a + " plus 1000  is " + (a+1000) + ".");

         return 0;

    } 

    

   public static void main(String args[])


   {


      int x=0;

      

       Scanner input = new Scanner(System.in);


       System.out.println("\n");

       System.out.println("\tPlus 10, 100, and 1000 Methods in Java");

       System.out.println();

      

        System.out.println("\tEnter an integer: ");

    


      x = input.nextInt();

      

     showNumberPlus10(x);

     showNumberPlus100(x);

     showNumberPlus1000(x);

        

       System.out.println();

       System.out.println("\tEnd of Program");

       System.out.println("\n");


   }


   

   


}


No comments:

Post a Comment