Friday, February 8, 2013

Excercise between W1 and W3

20 comments:

  1. /*demonstrate if else
    * id= 201210302
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    */
    package javaapplication14;
    import java.util.*;
    /**
    *
    * @author Administrator
    */
    public class ifelsedemo {

    /**
    * @param args the command line arguments
    */
    public static void main(String[] args) {
    // TODO code application logic here
    int i,j;
    Scanner c=new Scanner(System.in);
    System.out.print("enter your value for i: ");
    i=c.nextInt();
    System.out.print("enter your value for j: ");
    j=c.nextInt();
    if(i>j)
    System.out.println("i is bigger");
    else
    System.out.println("j is bigger");
    }
    }

    ReplyDelete
  2. package switchdemo;
    import java.util.Scanner;


    /**
    * @author Ashraf
    * SwitchDemo
    *ID: 201210887 */
    public class Switchdemo {

    /**
    * @param args the command line arguments
    */
    public static void main(String[] args) {
    Scanner input=new Scanner(System.in);
    int marks;
    marks=input.nextInt();
    switch(marks/10)
    {
    case 10:
    System.out.println("Excelent");
    break;
    case 9:
    System.out.println("Verey Good");
    break;
    case 8:
    System.out.println("Good");
    break;
    case 7:
    System.out.println("work hard");
    break;
    case 6:
    System.out.println("poor");
    break;
    case 5:
    System.out.println("veru poor");
    break;
    case 4:
    System.out.println("Need to improvement");
    break;
    default:
    System.out.println("Invaild data");
    break;

    }
    }
    }

    ReplyDelete
  3. /*Demonstrate fibonacci series example
    * ID: 201210269
    *
    *
    */
    package fibonacci;
    import java.util.Scanner;
    /**
    *
    * @author Administrator
    */
    public class Fibonacci {

    /**
    * @param args the command line arguments
    */
    public static void main(String[] args) {

    Scanner input=new Scanner(System.in);
    int num;
    num=input.nextInt();

    System.out.println("*****Fibonacci Series*****");

    int f1, f2=0, f3=1;

    for(int i=1;i<=num;i++){

    System.out.print(" "+f3+" ");

    f1 = f2;

    f2 = f3;

    f3 = f1 + f2;

    }
    }
    }

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete
  5. /*Demonstrate Binary Sort example
    * ID: 201210269
    *
    *
    */
    package binary.sort1;

    /**
    *
    * @author Administrator
    */
    public class BinarySort1 {

    /**
    * @param args the command line arguments
    */
    public static void main(String[] args) {
    int[] lisa={10,15,20,25,30,35,40,45,50,55};
    int i,m,c=0,L = 0,u,mid;
    m=40;
    for(i=0;i<10;i++)
    L=0;
    u=10-1;
    while(L<=u)
    {
    mid=(L+u)/2;
    if(m==lisa[mid])
    {
    c=1;
    break;
    }
    else if(m<lisa[mid])

    {
    u=mid-1;
    }
    else
    L=mid+1;
    }
    if(c==0)

    System.out.print("The number is not found.");

    else

    System.out.print("The number is found.");
    }
    }

    ReplyDelete
  6. /*
    Tutul Chandra Das.
    * ID NO : 201120179.
    * Batch 37th
    */
    package lengthdemo;

    /**
    *
    * @author Administrator
    */
    public class LengthDemo {

    /**
    * @param args the command line arguments
    */
    public static void main(String[] args) {
    String a , b;
    a = "I Love ";
    b = "Bangladesh";
    String c = a.concat(b) ;
    System.out.println("Output is :"+c);

    int length = c.length();
    System.out.println("Show the length :"+length);

    // TODO code application logic here
    }
    }

    ReplyDelete
  7. //Imam Uddin
    ID-201420733
    46th Batch

    import java.util.Scanner;
    public class JavaImam1 {

    /**
    * @param args the command line arguments
    */
    public static void main(String[] args) {
    // TODO code application logic here
    System.out.println("This is my first program");
    Scanner input = new Scanner(System.in);
    int a,b,c,d,f,g;
    System.out.print("First Number =");
    a=input.nextInt ();
    System.out.print("Second Number =");
    b=input.nextInt ();
    c=a+b;
    d=a-b;
    f=a*b;
    g=a/b;
    System.out.println("The sum is=" +c);
    System.out.println ("The Substraction Is=" +d);
    System.out.println("The Multiplication Is=" +f);
    System.out.println("The Diviedation Is=" +g);

    }
    }

    ReplyDelete
  8. /** Md. Imam Uddin
    ID-201420733
    46th Batch **/

    public static void main(String[] args) {

    Scanner input=new Scanner(System.in);
    int vehicles_wheels;


    System.out.print("Please give me wheels number=");
    vehicles_wheels = input.nextInt();
    if(vehicles_wheels == 4)
    {
    System.out.println("This is a car");
    }
    if(vehicles_wheels ==3)
    {
    System.out.println("This is a tricycle");
    }
    if(vehicles_wheels==2)
    {
    System.out.println("This is a motor Cycle");
    }
    }

    }

    ReplyDelete
  9. /* Md. Imam Uddin
    ID- 201420733
    46th Batch */

    //Use If-Else Statement in Java Programming

    package javacondition;

    import java.util.Scanner;

    public class JavaCondition {

    public static void main(String[] args) {

    Scanner input= new Scanner(System.in);
    int number;
    System.out.print("Check Status:");
    number=input.nextInt();

    if(number>=30)
    {
    System.out.println("You are Old.");
    }
    else
    {
    System.out.println("You ate Young.");
    }
    }
    }

    ReplyDelete
  10. //Exercise-1: Echoing words in Java

    //Md.Hasmot Hossen
    //Batch = 46th
    //ID No = 201421066


    package pz;
    public class Pz {
    public static void main(String[] args) {
    System.out.println("My name is Eng.(Md.Hasmot Ali)");
    System.out.println("This is my programming java");
    System.out.println("This is my blogspot");
    System.out.println("My university name AUB");
    }

    }

    ReplyDelete
  11. //Exercise 2: Inputting and Echoing integer and string entered by user
    //Md.Hasmot Hossen
    //Batch = 46th
    //ID No = 201421066

    package integerst;
    import java.util.Scanner;


    public class Integerst {

    public static void main(String[] args) {

    Scanner input = new Scanner(System.in);
    int serial;
    String content;

    System.out.print("Plz enter your serial ");
    serial = input.nextInt();

    System.out.print("Plz enter your content ");
    content = input.next();


    System.out.println("Your serial output:"+serial);
    System.out.println("Your content output:"+content);

    }

    }

    ReplyDelete
  12. // Exercise-3: How to use If Statement in Java Programming
    //Md.Hasmot Hossen
    //Batch = 46th
    //ID No = 201421066

    package ifelse;
    import java.util.Scanner;

    public class Ifelse {

    public static void main(String[] args) {
    Scanner input = new Scanner(System.in);
    int value;
    System.out.println("Plz enter your digit number ");
    value = input.nextInt();
    if(value>=20)
    {
    System.out.println("This is my choose value ");
    }

    }

    }

    ReplyDelete
  13. // Exercise-4: How to use If Else Statement in Java Programming

    //Md.Hasmot Hossen
    //Batch = 46th
    //ID No = 201421066

    package ifelse;
    import java.util.Scanner;

    public class Ifelse {

    public static void main(String[] args) {

    Scanner input = new Scanner(System.in);
    System.out.print("Plz enter your digit number ");

    int value = input.nextInt();

    if(value>=20 && value <=25)
    {
    System.out.println("This is my choose value ");
    }
    else
    {
    System.out.println("This is my not choose value ");
    }
    }

    }

    ReplyDelete
  14. This comment has been removed by the author.

    ReplyDelete
  15. This comment has been removed by the author.

    ReplyDelete
  16. ID 201420406
    package javaapplication1;
    public class JavaApplication1 {
    public static void main(String[] args) {
    System.out.println("This is my First java Tutorial Home Practise .");
    System.out.println("priyo nath chakma");
    System.out.println("Batch :46");
    System.out.println("ID:201420406");
    }
    }

    ReplyDelete
  17. // ID-201420733
    //46th Batch

    //if...else if...else Statement:

    package javaapplication7;

    import java.util.Scanner;
    public class JavaApplication7 {

    public static void main(String[] args) {

    Scanner input=new Scanner (System.in);
    int age;

    System.out.println("How Old are You?");
    age=input.nextInt();

    if(age<18)
    {
    System.out.println("You are a Child");
    }
    else if(age<30)
    {
    System.out.println("You are a Young");
    }
    else if(age<150)
    {
    System.out.println("You are a Old");
    }
    else
    {
    System.out.println("You'r Statement is False");
    }
    }
    }

    ReplyDelete

  18. // Exercise-5: How to Use If-ElseStatement in Java Programming

    //Md.Hasmot Hossen
    //Batch = 46th
    //ID No = 201421066

    package moreifelse;
    import java.util.Scanner;


    public class Moreifelse {


    public static void main(String[] args) {
    Scanner input = new Scanner(System.in);

    int color;

    System.out.println("Plz enter your color code");
    color = input.nextInt();


    if(color<12)
    {
    System.out.println("Color is Red");
    }

    else if(color>50)
    {
    System.out.println("Color is Bule");
    }

    if(color<2)
    {
    System.out.println("Color is gray");
    }

    else
    {
    System.out.println("Color is black");
    }

    }

    }

    ReplyDelete