The Cyber Knowhow Blog - Your Technology Reference

Hi!, WELCOME TO Live7n.com

| Location : programming | |

A blog about e-Business, Web hosting, Web design, Internet, Gaming, Software & Electronics
9
Jul

Learn Java by Studying sample programs

//prog1 Covertion of Celcious to Fahrenheit ///page no 1
import java.io.*;
import java.lang.*;
public class tempdegree
{
public static void main(String args[]) throws IOException
{

double c=0;
double f=0;
InputStreamReader reader = new InputStreamReader(System.in);
BufferedReader input = new BufferedReader(reader);
System.out.println(”Enter Temp in Fahrenheit =”);
String v1 = input.readLine();
f=Integer.parseInt(v1);
c=5.0/9.0*(f-32.0);
System.out.println(”Temp in Celcius =”+c);
if(c>37.4)
{
System.out.println(”There is Feaver”);
}
else
{
System.out.println(”There is no Feaver”);
}
}
}

///prog2 use of switch case
import java.io.*;
public class modiSwitch
{
public static void main(String args[]) throws IOException
{
int a=0,b=0,c=0, x=0;
InputStreamReader reader = new InputStreamReader(System.in);
BufferedReader input = new BufferedReader(reader);
System.out.print(”Enter 1st number= “);
String v1 = input.readLine();
a=Integer.parseInt(v1);
System.out.print(”Enter 2nd number= “);
String v2 = input.readLine();
b=Integer.parseInt(v2);
System.out.print(”Enter your option= “);
String v3 = input.readLine();
x=Integer.parseInt(v3);
switch(x)
{
case 1:
c=b+a;
System.out.println(”sum is =” +c);
break;
case 2:
c=b-a;
System.out.println(”diff is =” +c);
break;
case 3:
c=b*a;
System.out.println(”product is =” +c);
break;
default:
System.out.println(”invalid”);
}
} ///Page 2
}

///Prog 3 area and perimeter of a rectangle

import java.io.*;
import java.lang.*;
public class rectangle
{
public static void main(String args[]) throws IOException
{

float length=0;
float area=0;
float peri=0;
float breadth=0;
InputStreamReader reader = new InputStreamReader(System.in);
BufferedReader input = new BufferedReader(reader);
System.out.println(”Enter the length =”);
String v1 = input.readLine();
length=Integer.parseInt(v1);

System.out.println(”Enter the breadth =”);
String v2 = input.readLine();
breadth=Integer.parseInt(v2);
if(breadth
{
area=length*breadth;
peri=2*(length+breadth);
System.out.println(”area =”+area);
System.out.println(”Perimeter =”+peri);
}
else
System.out.println(”invalid breadth”);

}
}

///Prog 4 find the biggest out of three no.

import java.io.*;
import java.lang.*;
public class biggest
{
public static void main(String args[]) throws IOException
{

int a=0;
int b=0;
int c=0;

InputStreamReader reader = new InputStreamReader(System.in);
BufferedReader input = new BufferedReader(reader);
System.out.println(”Enter 1st num=”);
String v1 = input.readLine();
a=Integer.parseInt(v1);
System.out.println(”Enter 2nd num=”);
String v2 = input.readLine();
b=Integer.parseInt(v2);
System.out.println(”Enter 3rd num=”);
String v3 = input.readLine();
c=Integer.parseInt(v3);

if(a>b && a>c)
{
System.out.println(”Biggest is =”+a); ///Page 3
}
else
{
if(b>a && b>c)
{
System.out.println(”Biggest is =”+b);
}
else
{
System.out.println(”Biggest is =”+c);
}
}
}
}

//prog 5 Sum of even Number
import java.io.*;
import java.lang.*;
public class dowheel
{
public static void main(String args[]) throws IOException
{

int i=0;
int sum=0;
do
{
i+=2;
System.out.println(” “+i);
sum=sum+i;
} while (i<10);
System.out.println(”Sum = “+sum);
}
}

/// Prog 6 Leap year

import java.io.*;
import java.lang.*;
public class Leapyear
{
public static void main(String args[]) throws IOException
{

int y=0;

InputStreamReader reader = new InputStreamReader(System.in);
BufferedReader input = new BufferedReader(reader);
System.out.println(”Enter Year =”);
String v1 = input.readLine();
y=Integer.parseInt(v1);
if(y>9999)

{
System.out.println(”invalid, enter a valid year”);
}

if(y%4==0 && y%400!=0)
{
System.out.println(”This year is a leap year”);
}
else
{
System.out.println(”This year is not a leap year”);
} ///Page 4

}
}

///Prog 7 odd Number

import java.io.*;
import java.lang.*;
public class dogh
{
public static void main(String args[]) throws IOException
{

int i=0;
int n=0;

int sum=0;
do
{
n=2*i+1;
System.out.println(” “+n);
sum=sum+n;
i=i+1;
} while (n<9);
System.out.println(”Sum = “+sum);
}
}

///Prog 8 Calculater

// aWAP for using switch case
import java.io.*;
class casesw
{
public static void main(String args[])throws IOException
{
int a,b,c,x;
a=0;
b=0;
c=0;
x=0;
InputStreamReader reader = new InputStreamReader(System.in);
BufferedReader input = new BufferedReader(reader);
System.out.print(”Enter 1st number= “);
String v1 = input.readLine();
a=Integer.parseInt(v1);
System.out.print(”Enter 2nd number=”);
String v2 = input.readLine();
b=Integer.parseInt(v2);
System.out.print(”Enter your choice=”);
String v3 =input.readLine();
x=Integer.parseInt(v3);
switch(x)
{
case 1:
c=b+a;
System.out.println(”sum is =” +c);
break;
case 2:
c=b^a;
System.out.println(”diff is =” +c);
break;
case 3:
c=b*a;
System.out.println(”product is =” +c);
break;
case 4:
c=b/a;
System.out.println(”quotent is=”+c);
break;
default:
System.out.println(”invalid”);
}
}
}

//Prog9 Vol of a cone
import java.io.*;
import java.lang.*;
public class cone
{
public static void main(String args[]) throws IOException
{

double r=0;
double h=0;
double l=0;
double v=0;
InputStreamReader reader = new InputStreamReader(System.in);
BufferedReader input = new BufferedReader(reader);
System.out.println(”Enter Redius =”);
String v1 = input.readLine();
r=Integer.parseInt(v1);

System.out.println(”Enter hight =”);
String v2 = input.readLine();
h=Integer.parseInt(v2);

System.out.println(”Enter slant Hight =”);
String v3 = input.readLine();
l=Integer.parseInt(v3);

v=(3.14*r*r*h)/3;

System.out.println(”Volume is =” +v);

}
}

Filed under: programming

Featured Post

How to find royality free photos for designing your website

To make you website attractive to the visitors we need good quality images. You need a good quality digital camera for that. I have a 5 MP digital camera and i shoot photos with that. But a good knowledge of photography is essential for presenting any illustration on the subject of you website. Suppose  you are designing any  health  related website than an image of a doctor is nice for that. But for that you have to find model for that. Royalty free image provider arrange all this for you and you can get the benefit very easy  by  using the subscription of those  websites. High quality designer go for High resolution pictures for their websites. The best format for images are JPG, PNG and PSD.

There are some image using condition and it is better to go through those offer doc before using any photo for commercial purpose.  Otherwise if you like any photo for personal interest and want to use them in you personal website only then you can download them by give some credit to the photo owner. Royalty free images are not absolutely free and for each download you have to pay a certain amount of USD to the content provider. The business of sell photos is not a funny business. High quality photographer can earn a good living by this profession. Sometime not only camera images but also good quality vector images get high demand for the professional website coder.    A nice skill over Adobe photoshop CS2 or CS3 and make you vector image creation expert. Along with technique  a photo designer should have some creative power also.  vector drawing tutorial form the original expert and the training video for their official blog can be helpful for the beginners.  If you want to use any image for a template that created for commercial purpose that required some special permission form the copyright holder.

How to activate GPRS connection in your Mobile hand set

GPRS is a new advantage of mobile technology that enables your internet access facility at anywhere and at any place.

Slow connection reduce you productivities and the expencive costing of internet access can be reduce by giving a fixed rental to the mobile connection provider for GPRS connection.

1.JPG

Your can a check your email, investment in share market and surf the websites using this technique.

For that the most importantly you phone must be a GPRS enabling hand set.

In India almost all mobile services provider provide that facility in their telephone. To activate this facility you have to talk to your customer service executive about the solution of GPRS Connection. For BSNL mobile user it is not easy just calling a call center executive. For that you have to activate your GPRS services through an application written in particular format.

Other services provider like Airtel give this facility just by sending an SMS to there customers care number. Here you have to write ACT GPRS all in capital letter. You will get their reply and according to their instruction you can complete the GPRS connection.

Using that Software CD you can install the exact PC suit for you phone. Nokia Hand set user can get the one touch Access facility form their hand set’s PC suite.

You can also you the GPRS connection in you PC and Laptop. PC suite software is essential for that. Generally all GPRS enable Mobile hand set provides PC suit software along with their Box pack.

GPRS Internet Access Know how.

Just connect the Hand set to your PC using DATA cable or Blue tooth device and you can enjoy the GPRS facility at you PC. Enjoy!

Recent Comments

iphone games music

Nice blog, i have added it to my favourites, greetings

khayrul

i have a nokia 6300 mobile hands set. it hands set some problem. this mobile key pad is no work. pleas solve it. thanks.

deepu

mileap. in is a nice place to has a detailed step by step knowledge of this new sensation.