Btechadda.com

Archive for May, 2010

test

by Shivu on May.28, 2010, under Uncategorized

To write a java program that prints all real solutions of the expression ax2+bx+c=0.

Program:

import java.io.*;
class Qexp
 {
	  public static void main(String arg[])
	   {
			double a=5,b=2,c=3;
			double d,x1,x2;
			d=b*b-4*a*c;
			if(d<0)
			 {
				System.out.println("Roots are imaginary");
			 }
			else
			 {
				  x1=(-b+Math.sqrt(d))/(2*a);
				  x2=(-b-Math.sqrt(d))/(2*a);
				  System.out.println("x1=" + x1 + " x2=" + x2);
			 }
	   }
 }

Input & Output Analysis:-

Roots are imaginary
Leave a Comment more...

OOPS/JAVA downloads

by Shivu on May.08, 2010, under Java

JAVA Downloads

Unit 1

http://www.ziddu.com/download/9164946/OOPS-UNIT-2-byHkesavaraju4btechadda.pdf.html

Unit-2

http://www.ziddu.com/download/9164946/OOPS-UNIT-2-byHkesavaraju4btechadda.pdf.html

Unit 3

http://www.ziddu.com/download/9258306/OOPS-UNIT-3-byHkesavaraju4btechadda.com.pdf.html

Unit-5

http://www.ziddu.com/download/9258397/OOPS-UNIT-5-byHkesavaraju4btechadda.com.pdf.html

Unit 8

http://www.ziddu.com/download/9772855/javaunit8byhkesavarajuforbtechadda.pdf.html

Leave a Comment more...

OOPS/JAVA:Basics of Networking Programming

by hkesavaraju on May.07, 2010, under Java

Basics of Network Programming: The basics of networking fall into the following categories.

a) Overview of Socket: A network Socket is almost like an electrical socket. The various plugs around the network have a standard way of delivering their payloads. Anything which understands the standard protocol can plug in to the socket and communicate. There are many protocols used. They are:

(i) IP is a low level protocol which breaks data into small packets and forwards them to an address across the network but it doesn’t guarantee safe transmission.

(ii) TCP is a high level protocol which strings together all these packets and provides reliable transmitting of data.

(iii) UDP is next to TCP but it provides fast, unreliable connectionless packet transmission.

b) Proxy Servers: There are situations where a client has certain restrictions to communicate directly with the server. In such cases, the client would contact a proxy server which doesn’t have such restrictions and is easy to communicate with the client. A proxy server has ability to filter some requests or cache the results of those requests for the future use.

A cache proxy HTTP server is used to reduce the bandwidth demands on a local network’s connections to the internet. A proxy server is used in situations where a popular web site is being hit by several users, proxy server gets those pages and providing faster accessing them to the clients by saving expensive transfers each time it is hit by each user.

c) Internet Addressing: Internet address is the number that uniquely identifies each computer on the net. Each and every computer in internet has an address. This address can be represented either by IPV4 OR IPV6. IPV4 represents address in 32 bit format and is widely used scheme where as IPV6 represents address in 128 bit format..

d) Domain Name Service: I every one referred the addresses as numbers, then it won’t easy to navigate over the internet. Hence, a parallel hierarchy of names exists for the all these numbers which known as DNS. The name of the internet address known as domain name describes machine’s location in a name space from right to left.

e) client servers: A server is one which has some resource that can be shared. There are computer servers that provide computing power, print servers that manage a collection of printers, disk servers that provide networked disk space and web servers which store web pages.

A client is one which wants to access a particular server. The interaction between a client and server is just like an interaction between a lamp and an electrical socket. A server should be capable of accepting multiple clients connected to the same port number, although each session is unique.

f) Reserved Sockets: The high level protocol when connected ensures the port on which it is dependent. The TCP/IP reserves 1,024 ports for specific protocols. The protocol finds how a client should interact with the port. An example is HTTP is the protocol which is used for transferring pages and images.

g) Currency: It is included in java version 1.4 and is defined in java.util package. The structure of Currency is as follows:

public final class Currency extends Object implements Serializable

The Currency class represents a currency of a country. Currencies are identified by their ISO 4217 currency codes. Currency don’t have constructors and its instance is obtained by using getInstance().

Note: It is used to represent currencies of US dollars or Japanese Yen.

The Objects of currency class doesn’t represent a particular amount of currency but the currency unit itself.

The following program illustrates the Currency class:

public class currencydemo

{

public staticvoid main(String args[])

{

Currency c1=Currency.getInstance(Locale.US); // obtains instance for US dollar

System.out.println(“US dollar symbol is”+c1.getSymbol());

System.out.println(“US dollar in Canada is”+c1.getSymbol(Locale.CANADA);

Currency c2=Currency.getInstance(Locale.JAPAN); // obtains japan currency based on Locale

System.out.println(“the currency code for japan is”+c2.getCurrencyCode());

Currency c3=Currency.getInstance(“JPY”); // obtains japan currency based on code

if(c2!=c3) // compare currency objects

System.out.println(“objects are unequal”);

}

}

Output:

US dollar symbol is : $

US dollar in Canada is -

the currency code for japan is -

Leave a Comment more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Blogroll

A few highly recommended websites...