Sunday, October 4, 2009

Evaluation of base of a number in a quadratic expression....

The question is:
If the following quadratic expression is solved it results the decimal roots 8,5.what is the value of r?
x^2-(10)base r*x+(31)base r=0.

Here is the solution for the problem(according to me):
r is the base of the number 10 and 31.and if we evaluate the equation then we'll get root 8 and 5.
So, let r=8+5=13.
Now if we go with r=13,then we should get the value of x=8 & 5!
Now (10)base13=(13)base10 (converting into decimal)
and (31)base13=(40)base10 (converting into decimal)
=>x^2-(10)base r*x+(31)base r=0
=>x^2-13*x+40=0
=>x^2-8x-5x+40=0
=>x(x-8)-5(x-8)=0
=>(x-8)(x-5)=0
So,we get x=8,5.
So, r=13.

Sunday, September 27, 2009

The New Spelling of "Google" is "Googlle"??


I don't know that how many of you have observed the incident,but,today,27/09/09(Sunday),I've observed that a different spelling of "Google" is displaying in the home page of google.com.The original spelling is "Google" to which we are all very familiar but today it is shown as "Googlle" in it's home page!!I'm getting confused that is it their spelling mistake or something else!!
I have attached the displaying page,just check this out!!

Tuesday, September 8, 2009

Inner Class In Java............

There is an interesting topic in java,which is 'Innerclass'.I've tried to give you some idea about it.
It is possible to define a class within another class; such classes are known as nested classes.
The scope of a nested class is bounded by the scope of its enclosing class. Thus, if class B is
defined within class A, then B is known to A, but not outside of A. A nested class has access
to the members, including private members, of the class in which it is nested. However, the
enclosing class does not have access to the members of the nested class.
There are two types of nested classes:
i)static and ii)non-static.
A static nested class is one which has the static modifier applied. Because it is static,
it must access the members of its enclosing class through an object.
That is, it cannot refer to members of its enclosing class directly.
Because of this restriction, static nested classes are seldom used.
The most important type of nested class is the inner class. An inner class is a
non-static nested class. It has access to all of the variables and methods of its outer class
and may refer to them directly in the same way that other non-static members of the
outer class do. Thus, an inner class is fully within the scope of its enclosing class.
The following program illustrates how to define and use an inner class:


/* Example Related Inner Class */

class B
{
int x=10;
void set()
{
A in=new A();
in.show();
}
class A
{
void show()
{
System.out.println("The value of x:"+10);
}
}
}
class Innetcls
{
public static void main(String args[])
{
B ob=new B();
ob.set();
}
}
Now if we're looking at output,then we will see that it will give 10.
Here Class A is the inner class of the class B.
Hope you have enjoyed it........

Monday, September 7, 2009

Hollow Rhombus example in java............


This is my 1st post to this blog.Here I've tried to solve,one of the most common programming
construct through java.The problem name is 'Hollow Rhombus Example'.This type of tusks has
generally given to us as an assignment to clear our programing concept,mainly looping concept.
I have done similar type of example in C,
@1st year in my B.Tech course.Here I've done it through java.The output of the problem would be
a hollow rhombus.The building concept will be much more easier to us,if we divide the entitr tusk into
4 modules.
i)Printing the 1st line as it is.
ii)Generate the upper half of the triangle.
ii)Generate the lower half of the triangle.
iv)Finally printing the last line.
Here is the source code for the tusk and corresponding outputs.I think it will help you more to understand the
problem more suitably.

/* Code For The Tusk*/

import java.io.*;
class Triangle{
public static void main(String args[]) throws IOException{
int n,i,j,z,y,chlen,sp=-2,str=0; //initializing the variables.....
String ch="";
DataInputStream dis=new DataInputStream(System.in);
System.out.print("Entern Any String:");
ch=dis.readLine(); //talking input..............
chlen=ch.length();
ch=ch+"*"+ch;
System.out.print("\n"+ch); //printing the 1st line............
for(i=0;i{
System.out.println();
sp+=2;
for(j=0;j<(chlen-i);j++)
System.out.print(ch.charAt(j));
for(z=0;z<=sp;z++)
System.out.print(" ");
for(y=str;ySystem.out.print(ch.charAt(y));
str++;
}
str -= 2 ;
for(i=chlen-1-1;i>=0;i--) //code to generate the lower half.............
{
System.out.println();
sp-=2;
for(j=0;j<(chlen-i);j++)
System.out.print(ch.charAt(j));
for(z=sp;z>=0;z--)
System.out.print(" ");
for(y=str;ySystem.out.print(ch.charAt(y));
str--;
}
System.out.print("\n"+ch+"\n"); //printing the last line............
}
}

Thursday, June 11, 2009

Hi To All.........

This is my first post to the blog...........will post some new items within a few days............