Saturday, 13 September 2014

Swapping two numbers

java source code

import java.util.*;
class swap
{
  public static void main(String[] args)
   {
     Scanner scr=new Scanner(System.in);
     System.out.print("Enter first number:");
     int n1=scr.nextInt();
     System.out.print("Enter second number:");
     int n2=scr.nextInt();
System.out.println("The first number is "+n1+" and the second number is "+n2);
       /*logic for swapping,
       1>assign number1 to a temporary variable
       2>assign number2 to number1
       3>assign temporary variable to number1*/
     int temp=n1;
     n1=n2;
     n2=temp;
System.out.print("After swapping, the first number is "+n1+" and the second number is "+n2);
  }
}

Unit conversion in java(km->m)

java source code

import java.util.*;
class UnitConverg
{
   public static void main(String args[])
   {
     Scanner scr=new Scanner(System.in);
     System.out.print("Enter units in Km to be converted ");
       int Km=scr.nextInt();
     int m=Km*1000;
     System.out.print("Unites in m is "+m);
   }
}

Calculation of Simple Interest

java source code

import java.util.*;
public class SimpleInterest
{
public static void calculate(int principal, int time, int rate)
{
     double interest = principal * time * rate / 100;
     double amount = principal + interest;
     System.out.println("Interest is " + interest);
     System.out.println("Amount is " + amount);
}
   public static void main(String args[])
{
     Scanner scr=new Scanner(System.in);
     System.out.print("Enter Principal Amount:");
     int principal=scr.nextInt();
     System.out.print("Enter time:");
     int time=scr.nextInt();
     System.out.print("Enter rate of interest:");
     int roi=scr.nextInt();
     calculate(p,t,r);
   }
}

Program in java

Addition of two numbers

java source code

import java.util.*;
class Addition
{
  public static void main(String args[])
  {
     Scanner scr=new Scanner(System.in);
     System.out.print("Enter 1st number:");
     int n1=scr.nextInt();
     System.out.print("Enter 2nd number:");
     int n2=scr.nextInt();
     int sum=n1+n2;
     System.out.println("Addition of "+n1+" and "+n2+" is "+sum);
   }
}

Friday, 12 September 2014

Program in java




Basic Programs Conditional Programs
Sum of Two numbers Larger between two vaiables
Calculate Simple Interest Largest using ternary Operator
unit conversion Km-->meters Larger among three vaiables
Swap two variables Larger among three vaiables using nested if else

BLOG IN CONTRUCTION......

LARAVEL ...installation

l.jpg








LARAVEL






Installation (windows)    


Step 1

  • Install composer from link on laravel official website
           Laravel utilizes composer to manage its dependencies. First download a copy of the compose.phar once you have PHAR archive, you can either keep it in your local project directory or move to user/local/bin to use it globally on your system. On Windows, you can use the composer windows installer

Step 2

  • Through command prompt
                   -via Laravel Installer
                            First, download the Laravel installer using Composer.
                          Command: “composer global require "laravel/installer=~1.1"
Make sure to place the ~/.composer/vendor/bin directory in your PATH so the laravel executable is found when you run the laravel command in your terminal.
Once installed, the simple laravel new command will create a fresh Laravel installation in the directory you specify. For instance, laravel new blog would create a directory named blog containing a fresh Laravel installation with all dependencies installed. This method of installation is much faster than installing via Composer.
Step 3

  • Via Composer Create-Project
            You may also install Laravel by issuing the Composer create-project command in your terminal:
Command=”composer create-project laravel/laravel --prefer-dist