I am a self starter and also a quick learner. I'm an active proponent of Modern Software development Languages.I am highly motivated, with ambitions to work for a company whose high standard match my own. I am conscientious and experienced in all aspects of software development.
Tuesday, 3 January 2017
Fibonacci Series in Java
import java.util.Scanner; class Fabonacci { public static void main(String[] args) { // declare variable int FirstNumber,SecondNumber; // initialize variable FirstNumber = 1; SecondNumber = 1; //taking input from user using Scanner class System.out.println("Plase Enter Number For Generate Fabonacci Series"); Scanner scan = new Scanner(System.in); int Val = scan.nextInt(); while(FirstNumber < Val) { System.out.println(FirstNumber); FirstNumber = FirstNumber + SecondNumber; SecondNumber = FirstNumber - SecondNumber; } } }
Monday, 2 January 2017
Basic Calculator in Java
import java.util.Scanner; public class HelloWorld { public static void main(String[] args) { System.out.println("Calculator"); int First, Second; String CaseArg; Scanner scan = new Scanner(System.in); System.out.println("Give me First Number"); First = scan.nextInt(); System.out.println("Give me Second Number"); Second = scan.nextInt(); System.out.println("Give me Operation Name"); CaseArg = scan.next(); Calculator Calculator = new Calculator(First, Second); switch(CaseArg){ case "Add": System.out.println("Answer = "+ Calculator.Add()); break; case "Subtract": System.out.println("Answer = "+ Calculator.Subtract()); break; case "Multiply": System.out.println("Answer = "+ Calculator.Multiply()); break; case "Divide": System.out.println("Answer = "+ Calculator.Divide()); break; default: System.out.println("Undefined Operations"); break; } } } class Calculator { private int input1; private int input2; public Calculator(int Param1, int Param2) { this.input1 = Param1; this.input2 = Param2; } public int Add() { return this.input1 + this.input2; } public int Subtract() { return this.input1 - this.input2; } public int Multiply() { return this.input1 * this.input2; } public int Divide() { return this.input1 / this.input2; } }
Subscribe to:
Posts (Atom)