Showing posts with label quotient of two numbers in java. Show all posts
Showing posts with label quotient of two numbers in java. Show all posts

Sunday, February 19, 2017

Quotient of Two Numbers in Java

In this sample program that I wrote it will ask the user to give two numbers and then our program will find the quotient of the two numbers and display the results on the screen using Java as our programming language.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.





Sample Program Output


Program Listing

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package quotient_two;


import java.util.Scanner;

/**
 *
 * @authors Jake R. Pomperada and  Jacob Samuel F. Pomperada
 * Date : February 19, 2017  Sunday
 * Language : Java
 * IDE     : NetBeans
 */
public class Quotient_Two {

    /**
     * @param args the command line arguments
     */
   public static int div_two_number(int n1, int n2) {
      int div=0;
      
      div = (n1/n2);

      return div;
   } 
    void display()
    {
       int num1=0, num2=0, div_all=0;

        Scanner s = new Scanner(System.in);
     
        System.out.println();
        System.out.println("=== Quotient of Two Numbers Using Method in Java === ");
        System.out.println();
      
         System.out.print("Enter First Value : ");
         num1 = s.nextInt();
            
         System.out.print("Enter Second Value : ");
         num2 = s.nextInt();
                 
         div_all = div_two_number(num1,num2);
  
        System.out.println();
        System.out.println("===== DISPLAY RESULTS ======");
        System.out.println();
        System.out.println("The quotient betweem " + num1 + " and "
                     + num2 + " is " + div_all + ".");

        System.out.println();
        System.out.println("===== END OF PROGRAM ======");
        System.out.println();
    }
    
    public static void main(String[] args)
      {
        // TODO code application logic here
      Quotient_Two demo  = new Quotient_Two();
      demo.display();
            
    }
    
}