Deitel-ch2

Example2_5

posted Jan 20, 2014, 1:04 AM by dldar masud   [ updated Jan 20, 2014, 1:04 AM by Karwan Jacksi ]

//Example2_5

public class Example2_5 {
public static void main(String[] args){
int x = 200;
System.out.printf("\n %%5x = %d\n", x * 5 /100);
        System.out.printf("\n\"each\"\t\"word\"\t\"is\"\n");
        System.out.printf("\n\"tabed\"\t\"over\"\t\"once\"");
}

}

Example2_7

posted Jan 20, 2014, 12:59 AM by dldar masud   [ updated Jan 20, 2014, 12:59 AM by Karwan Jacksi ]

// Example2_7


import java.util.*;
public class Example2_7
 {
static Scanner console = new Scanner(System.in);
public static void main(String[] args)
       {
int x, y, perime, area;
System.out.print("Enter length, width :");
x = console.nextInt();
y = console.nextInt();
perime = (x + y) * 2;
area = x * y;
System.out.printf("Perime = %d, area = %d", perime, area);
}

}

Example2_2

posted Jan 20, 2014, 12:55 AM by dldar masud   [ updated Jan 20, 2014, 12:55 AM by Karwan Jacksi ]

//Example2_2

public class Example2_2 {
    public static void main(String[] args){
    long salary = 1000000;
    double tax, netSalary;
    tax = salary * 10 / 100;
    netSalary = salary - tax;
    System.out.print("Your salary is : \t" + salary );
    System.out.println();
    System.out.println("Tax of salary is : \t" + tax );
    System.out.print("Your net salary is : \t" + netSalary );
    }
}

1-3 of 3