Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» Download - Green Lantern 2011
Input Computation - Using Methods EmptySun Sep 25, 2011 4:47 pm by Admin

» Download - Shark Night 3D
Input Computation - Using Methods EmptySun Sep 25, 2011 4:41 pm by Admin

» Download - Apollo 18
Input Computation - Using Methods EmptyWed Sep 21, 2011 6:37 am by Admin

» [REMODELLED] PSP E1000 - REVAMPED
Input Computation - Using Methods EmptyMon Sep 19, 2011 9:56 am by Admin

» PS VITA IS OFFICIALLY REGION FREE!!
Input Computation - Using Methods EmptyMon Sep 19, 2011 9:49 am by Admin

» Manga - Popcorn Avatar
Input Computation - Using Methods EmptyMon Sep 19, 2011 9:11 am by Admin

» [UPCOMING SOON] Assassin's Creed - Revelations
Input Computation - Using Methods EmptyMon Sep 19, 2011 8:44 am by Admin

» Assassin's Creed 2
Input Computation - Using Methods EmptyMon Sep 19, 2011 8:26 am by Admin

» Assassin's Creed
Input Computation - Using Methods EmptyMon Sep 19, 2011 6:47 am by Admin

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

You are not connected. Please login or register

View previous topic View next topic Go down  Message [Page 1 of 1]

Admin

Admin
Investor Persona
File name: methods.java

Code:

import java.io.*;
public class methods {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    String name;
    int age;

    public static void main(String[] args)throws IOException {
            methods m = new methods();
            m.menu();
    }
    public void menu()throws IOException{
            this.name="";
            this.age=26;
            display();
    }
    public void display()throws IOException{
            double num1, num2, sum, diff, prod, mod, ave, quot;
            System.out.println("Enter your Name:");
            this.name = this.br.readLine();
            System.out.println("Enter Number1:");
            num1 = Double.parseDouble(this.br.readLine());
            System.out.println("Enter Number2:");
            num2 = Double.parseDouble(this.br.readLine());
            sum = add(num1, num2);
            diff = diff(num1, num2);
            prod = prod(num1, num2);
            mod = mod(num1, num2);
            ave = sum/2;
            quot = quot(num1, num2);
            System.out.println("Name:"+this.name);
            System.out.println("Age:"+this.age);
            System.out.println("Sum:"+sum);
            System.out.println("Difference:"+diff);
            System.out.println("Product:"+prod);
            System.out.println("Modulo:"+mod);
            System.out.println("Average:"+ave);
    }
    public double add(double num1, double num2){
            double sum;
            sum = num1+num2;
            return sum;

    }

    public double prod(double num1, double num2){
            double prod;
            prod = num1*num2;
            return prod;

    }

      public double diff(double num1, double num2){
            double diff;
            diff = num1-num2;
            return diff;

    }

      public double mod(double num1, double num2){
            double mod;
            mod = num1%num2;
            return mod;

    }
        public double quot(double num1, double num2){
            double quot;
            quot = num1/num2;
            return quot;

    }

}

https://advatar.forumotion.com
Share this post on: reddit

No Comment.

View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum

 

Create a forum | ©phpBB | Free forum support | Report an abuse | Forumotion.com