Wednesday, November 26, 2014

Creating Array List With Scanning In Java

Program:

import java.util.Scanner;
public class practice {
public static void main(String[] args){
int[] public_ara=new int[100];
System.out.println("Enter some numbers: ");
Scanner in=new Scanner(System.in);
for(int j=0;j<5;j++){
public_ara[j]=in.nextInt();
}
System.out.println("Serial\taralist");

for(int i=0;i<5;i++){
System.out.println(i + "\t" +public_ara[i]);
}

}
}

Output:

Enter some numbers: 
15
13
54
21
62
Serial aralist
0 15
1 13
2 54
3 21
4 62

ScreenShot

Program


Output



Tuesday, November 25, 2014

Convert Fahrenheit to Celsius In Java

Program:

import java.util.Scanner;
public class f2c {
public static void main(String[] arrgs){
Scanner in=new Scanner(System.in);
double x,result;
System.out.println("Enter temperature in farenhiet: ");

x=in.nextDouble();
result=((x-32)*5)/9;
System.out.println("The temperature converts into celcius and that is: "+result);

}

}

Output:

Enter temperature in farenhiet:
278.15
The temperature converts into celcius and that is: 136.75

Screenshots

Program


Output



Print Odd or Even Number In java

Program:

package odd_or_even;
import java.util.Scanner;
public class jor_bijor {
public static void main(String[] args){
Scanner in = new Scanner(System.in);
int x;
System.out.println("Enter a number to check: ");
x=in.nextInt();

if(x % 2==0){
System.out.println("The number is even");
}
else{
System.out.println("The number is odd");
}
}
}

Output:

Enter a number to check:
15
The number is odd

Program


Output


Monday, November 17, 2014

GUI==>Graphical User Interface In Java

Program:

package java_tutorial_1;

import javax.swing.JOptionPane;
public class gui {
public static void main(String[] args){
String fn=JOptionPane.showInputDialog("Enter first number: ");
String sn=JOptionPane.showInputDialog("Enter second number: ");

int num1=Integer.parseInt(fn);
int num2=Integer.parseInt(sn);

int res=num1+num2;
JOptionPane.showMessageDialog(null,"answer "+ res,"title", JOptionPane.PLAIN_MESSAGE);
}

}

Screenshots

Program


Output 1


Output 2


Output 3


Friday, November 14, 2014

Twitter

Wednesday, November 12, 2014

Add variables using for loop In Java

Program:

package sum_project;
import java.util.Scanner;
public class summation {
public static void main(String[] args){
Scanner moni=new Scanner(System.in);
int userinput;
int sum=0;

System.out.println("Enter a number: ");
userinput=moni.nextInt();
if(userinput<0){
System.out.println("there are no number : ");
}
else{
for(int i=1;i<=userinput;i++){
sum=sum+i;
}
}
System.out.println("The sum is: "+sum);
}

}

Output:

Enter a number: 
20
The sum is: 210

Screenshot:

Program:


Output:


Mini Project Word Ripp In Java Language

Program:

package wordgame;
import java.util.Scanner;
public class word {
public static void main(String[] args){

String name;
String city;
String district;
String fathername;
String mothername;
String schoolname;
String thana;

Scanner moni=new Scanner(System.in);
System.out.println("Enter your name: ");
name=moni.nextLine();

System.out.println("Enter your city name: ");
city= moni.nextLine();
System.out.println("Enter your district name: ");
district=moni.nextLine();
System.out.println("Enter father name: ");

fathername=moni.nextLine();
System.out.println("Enter your mother name: ");
mothername=moni.nextLine();

System.out.println("Enter your school name: ");
schoolname=moni.nextLine();
System.out.println("Enter your thana name: ");
thana=moni.nextLine();
System.out.println("My name is "+name+ "."+
" I live in "+city+"."+" My father's name is "+fathername+"."+" My mother's name is "
+mothername+ "."+" My school name was "+schoolname+"."+" My district name is                              "+district+"."+
" And the thana is "+thana+".");
}

}
Output:

Enter your name: 
jack
Enter your city name: 
Naraingonj
Enter your district name: 
Dhaka
Enter father name: 
Redclief
Enter your mother name: 
Belly
Enter your school name: 
Udaigar school
Enter your thana name: 
Dhaka
My name is jack. I live in Naraingonj. My father's name is Redclief. My mother's
 name is Belly. My school name was Udaigar school. My district name is Dhaka. An
d the thana is Dhaka.



Screenshots:

Program:


Output:



Mini project Miles per gallon In Java Language

Program:

package milespergalon;
import java.util.Scanner;
  //class method
public class mpg {
//main method
public static void main(String[] args){
double miles_used;
double galon_used;
double mile_per_galon;

Scanner moni=new Scanner(System.in);
System.out.println("How many miles you have driven: ");

miles_used=moni.nextDouble();
System.out.println("How many galons you have used: ");

galon_used=moni.nextDouble();

mile_per_galon=miles_used/galon_used;

System.out.println("Here this is your main result miles per galon is 25" + mile_per_galon);


}

}

Output:

How many miles you have driven: 
30
How many galons you have used: 
12
Here this is your main result miles per galon is 2.5

Screenshot

Program


Output By input Value 30&12


Tuesday, November 11, 2014

Multiple Class In Java

Program:

package nulticlass;

public class multi {
public static void main(String[] args){
multa object=new multa();
object.mela();
object.another_mela();
}
}

public class multa {
public void mela(){
System.out.println("here this is multi class in this program");
}
public void another_mela(){
int a=12,b=48,result=a+b;
System.out.println("the output of the method is "+ result);
}

}

Output:

here this is multi class in this program

the output of the method is 60

Screenshot

Program


Step 1:class



Step 2:Another class

Output





Sunday, November 9, 2014

Embedding PHP on HTML

Program:

<?php
     $teta="last name";
?>
<input type="text" name="name" value="<?php echo $teta; ?>"> 

Screenshot

Program



Output




Indentation In PHP

Indentation:

It means using Curly brackets { } in programming.

<?php
//indentation two types....1.end of line indentation

$text=15;
if($text==15){     //  here this is the end of line indentation
echo 'The number is really fifteen';
}else{
echo 'The number is not fifteen';
}
//  2.next line indentation

$text=12;
if($text==15)
{     //  here this is the next line indentation
echo 'The number is really fifteen';
}
else
{
echo 'The number is not fifteen';
}
?>

Output:

The number is really fifteen
The number is not fifteen 


Screenshots:

Program:


Output


Monday, November 3, 2014

Print Asterisk In Java By increment operator

Program:

package prem1;

public class mohona1 {
public static void main(String[] args){
for(int i=1;i<5;i++){
for(int j=0;j<5-i;j++){
System.out.print(" ");
}
for(int k=0;k<i;k++){
System.out.print("*");
}
System.out.println(" ");
}
}

}

Output:

      *
    **
  ***
****

Screenshots

Program


Output



Monday, October 20, 2014

Print Stylish Asterisk In Java By increment operator

Program:

package prem6;

public class koresi6 {
public static void main(String[]args){
for(int i=1;i<=5;i++){
for(int j=1;j<=i;j++){
System.out.print("*");
}
System.out.println("");
}
}
}
Increment operator:   i++ and j++

Output:

*
**
***
****
*****

Screenshots

Program




Output



Sunday, October 19, 2014

Using Array In Java

Program:

package prem5;

public class koresi5 {
public static void main(String[]args){

int munim[]={12,54,95,68,87,32,45,15};

System.out.println("the 4th number element is " +munim[5]);
}
}

Output:

the 4th number element is 32

Screenshots

Program


Output


Araray In Java

Program:

package prem5;

public class koresi5 {
public static void main(String[]args){
int munim[]=new int[20];

munim[0]=654;
munim[1]=951;
munim[9]=357;

System.out.println(munim[9]);
}
}


Output:

357



Program


Output


Friday, October 17, 2014

Random Number generator In Java

Program:

package prem4;

import java.util.Random;

public class koresi4 {
public static void main(String[]args){
Random trace=new Random ();
int counter;
int number;
for(counter=0;counter<10;counter++){
number=trace.nextInt(8);
System.out.println(number+"");
}
}
}

Output:

2
4
2
3
7
6
3
1
0
3


Screenshots

Program


Output


Mathematical Methods In Java

Program:

package prem3;

public class koresi3 {
public static void main(String[] args){
System.out.println(Math.abs(-3.8)); //absolute value will be the output
System.out.println(Math.pow(3.3, 2));//here 3.3^2=10.88999999999 
System.out.println(Math.max(294, 654));//here the maximum value will be the output
System.out.println(Math.min(856, 121));//here the minimum value is 121
System.out.println(Math.ceil(9.8));//here 9.8 will be 10
System.out.println(Math.ceil(13.4));//here 13.4 will be 14
System.out.println(Math.floor(45.6));//here 45.6 will be 45
System.out.println(Math.sqrt(225));//sqrt means sqare route so output 15
}
}


Output:

3.8
10.889999999999999
654
121
10.0
14.0
45.0
15.0

Screenshots

Program


Output


Thursday, October 16, 2014

Software: Find Interest Using Formula In Java

Software: Find Interest Using Formula In Java: Program: //formula:A=p*(1+r)^n package perm; public class koresi { public static void main(String[]args){ double real=1000; d...

Wednesday, October 15, 2014

Using Do While Loop In Java

Program:

package prem2;

public class koresi2 {
public static void main(String[]args){
int count=10;
do{
System.out.println(count);
count++;
}while(count<=20);
}

}

Output:

10
11
12
13
14
15
16
17
18
19
20
Program


Output


Find Interest Using Formula In Java

Program:

//formula:A=p*(1+r)^n

package perm;

public class koresi {
public static void main(String[]args){
double real=1000;
double rate=0.01;
double result;
int day;
for(day=1;day<=20;day++){
result=real*Math.pow(1+rate, day);
System.out.println(day+"  "+result);
}
}
}

Output:

1  1010.0
2  1020.1
3  1030.3010000000002
4  1040.60401
5  1051.0100501000002
6  1061.520150601
7  1072.13535210701
8  1082.8567056280801
9  1093.6852726843608
10  1104.6221254112045
11  1115.6683466653164
12  1126.8250301319697
13  1138.0932804332895
14  1149.4742132376225
15  1160.9689553699986
16  1172.5786449236987
17  1184.3044313729356
18  1196.147475686665
19  1208.1089504435315
20  1220.190039947967


Program


Output


Friday, September 26, 2014

For Loops In Java Programming

Program:

package serial;

public class tab{
public static void main(String[]args){
int count;
for(count=1;count<=10;count++){
System.out.println(count);
}

}

}

Output:

1
2
3
4
5
6
7
8
9
10

Screenshots

Program



Output


Using Multiple Class In Java

Program:

package munim2;
import java.util.Scanner;
public class rab {
public static void main(String[]args){
Scanner mon=new Scanner(System.in);
jab jabobject=new jab ();

System.out.println("Enter your real name: ");
String name=mon.nextLine();

jabobject.dress(name);
}

}

You must have to take another class to the same source file of the same package.


package munim2;

public class jab {
public static void dress(String name){
System.out.println("Hey "+name);
}

}

Follow the screenshots:

Screenshots

Set Class


Program






Output



Wednesday, September 24, 2014

Simple Hello World Program In PHP

Program:

<?php
     echo 'hello world';

?>

Output In the browser:    hello world


Screenshots

Program


Output



Monday, September 22, 2014

Find Average Using While Loop In Java

Program:


import java.util.Scanner;
public class readerr {
public static void main(String[]args){
Scanner mon=new Scanner(System.in);

double total=0;
double one;
double count = 0;
double average;

while(count<10){
one=mon.nextDouble();
total=total+one;
count++;
}
average=total/10;
System.out.println("the average of the numbers is "+total);

}



Screenshots

Program


Output





where is the wrong keyword written.........find out

Find Average by Scanning In Java

Program:

package munim;
import java.util.Scanner;
public class reader {
public static void main(String[]args){
double a,b,c,average;
Scanner mon=new Scanner(System.in);
a=mon.nextDouble();
b=mon.nextDouble();
c=mon.nextDouble();
average=(a+b+c)/3;
System.out.println("the average is "+average);

}
}

Screenshots

Progam


Output