< Page 2 of 4 > >> |
From: dj_glitzzz | Reply 21 of 73 | Reply | View replies (6)
|
Subject: Contributed Answer/Explanation to Q. 26 |
:-
<p>
import java.io.*;
</p>
<p>
class input
</p>
<p>
{
</p>
<p>
public static void main(String arg[])throws IOException
</p>
<p>
{
</p>
<p>
BufferedReader br=new BufferedReader(new
InputStreamReader(System.in));
</p>
<p>
System.out.println("Enter String:");
</p>
<p>
String s1=br.readLine( ); //take the input
</p>
<p>
String s2=""; //create a blank string to store the reverse value
</p>
<p>
int L=s1.length( ); //store the length
</p>
<p>
char ch,ch2;
</p>
<p>
int vowel=0; // create a counter for counting the no. of vowels
</p>
<p>
</p>
<p>
for(int i=0;i<L;i++)
</p>
<p>
{
</p>
<p>
ch=s1.charAt(i); //stores the character of that particular
index
</p>
<p>
</p>
<p>
if(ch=='A'||ch=='E'||ch=='I'||ch=='O'||ch=='U'||ch=='a'||ch=='e'||ch=='i'||c
h=='o'||ch=='u')
</p>
<p>
{
</p>
<p>
vowel++;
</p>
<p>
}
</p>
<p>
}
</p>
<p>
</p>
<p>
for(intj=L;j>=0;j--)
</p>
<p>
ch2=s1.charAt(j); //stores the character of that particular index
</p>
<p>
s2=s2=ch2; // stores the reverse string
</p>
<p>
}
</p>
<p>
System.out.println("total no. of characters:"+L);
</p>
<p>
System.out.println("no. of vowels:"+vowels);
</p>
<p>
System.out.println("reverse string:"+s2);
</p>
<p>
}
</p>
<p>
}
</p>
<p>
</p>
<p>
</p>
Posted at: Tue Jan 26 14:55:13 2010 (GMT)
|
From: dj_glitzzz | Reply 22 of 73 | Reply | |
Subject: Contributed Answer/Explanation to Q. 26 |
:-
<p>
import java.io.*;
</p>
<p>
class input
</p>
<p>
{
</p>
<p>
public static void main(String arg[])throws IOException
</p>
<p>
{
</p>
<p>
BufferedReader br=new BufferedReader(new
InputStreamReader(System.in));
</p>
<p>
System.out.println("Enter String:");
</p>
<p>
String s1=br.readLine( ); //take the input
</p>
<p>
String s2=""; //create a blank string to store the reverse value
</p>
<p>
int L=s1.length( ); //store the length
</p>
<p>
char ch,ch2;
</p>
<p>
int vowel=0; // create a counter for counting the no. of vowels
</p>
<p>
</p>
<p>
for(int i=0;i<L;i++)
</p>
<p>
{
</p>
<p>
ch=s1.charAt(i); //stores the character of that particular
index
</p>
<p>
</p>
<p>
if(ch=='A'||ch=='E'||ch=='I'||ch=='O'||ch=='U'||ch=='a'||ch=='e'||ch=='i'||c
h=='o'||ch=='u')
</p>
<p>
{
</p>
<p>
vowel++;
</p>
<p>
}
</p>
<p>
}
</p>
<p>
</p>
<p>
for(intj=L;j>=0;j--)
</p>
<p>
ch2=s1.charAt(j); //stores the character of that particular index
</p>
<p>
s2=s2=ch2; // stores the reverse string
</p>
<p>
}
</p>
<p>
System.out.println("total no. of characters:"+L);
</p>
<p>
System.out.println("no. of vowels:"+vowels);
</p>
<p>
System.out.println("reverse string:"+s2);
</p>
<p>
}
</p>
<p>
}
</p>
<p>
</p>
<p>
</p>
Posted at: Tue Jan 26 14:56:31 2010 (GMT)
|
From: dj_glitzzz | Reply 23 of 73 | Reply | |
Subject: Contributed Answer/Explanation to Q. 26 |
:-
<p>
import java.io.*;
</p>
<p>
class input
</p>
<p>
{
</p>
<p>
public static void main(String arg[])throws IOException
</p>
<p>
{
</p>
<p>
BufferedReader br=new BufferedReader(new
InputStreamReader(System.in));
</p>
<p>
System.out.println("Enter String:");
</p>
<p>
String s1=br.readLine( ); //take the input
</p>
<p>
String s2=""; //create a blank string to store the reverse value
</p>
<p>
int L=s1.length( ); //store the length
</p>
<p>
char ch,ch2;
</p>
<p>
int vowel=0; // create a counter for counting the no. of vowels
</p>
<p>
</p>
<p>
for(int i=0;i<L;i++)
</p>
<p>
{
</p>
<p>
ch=s1.charAt(i); //stores the character of that particular
index
</p>
<p>
</p>
<p>
if(ch=='A'||ch=='E'||ch=='I'||ch=='O'||ch=='U'||ch=='a'||ch=='e'||ch=='i'||c
h=='o'||ch=='u')
</p>
<p>
{
</p>
<p>
vowel++;
</p>
<p>
}
</p>
<p>
}
</p>
<p>
</p>
<p>
for(intj=L;j>=0;j--)
</p>
<p>
ch2=s1.charAt(j); //stores the character of that particular index
</p>
<p>
s2=s2=ch2; // stores the reverse string
</p>
<p>
}
</p>
<p>
System.out.println("total no. of characters:"+L);
</p>
<p>
System.out.println("no. of vowels:"+vowels);
</p>
<p>
System.out.println("reverse string:"+s2);
</p>
<p>
}
</p>
<p>
}
</p>
<p>
</p>
<p>
</p>
Posted at: Tue Jan 26 14:57:25 2010 (GMT)
|
From: dj_glitzzz | Reply 24 of 73 | Reply | |
Subject: Contributed Answer/Explanation to Q. 26 |
:-
<p>
import java.io.*;
</p>
<p>
class input
</p>
<p>
{
</p>
<p>
public static void main(String arg[])throws IOException
</p>
<p>
{
</p>
<p>
BufferedReader br=new BufferedReader(new
InputStreamReader(System.in));
</p>
<p>
System.out.println("Enter String:");
</p>
<p>
String s1=br.readLine( ); //take the input
</p>
<p>
String s2=""; //create a blank string to store the reverse value
</p>
<p>
int L=s1.length( ); //store the length
</p>
<p>
char ch,ch2;
</p>
<p>
int vowel=0; // create a counter for counting the no. of vowels
</p>
<p>
</p>
<p>
for(int i=0;i<L;i++)
</p>
<p>
{
</p>
<p>
ch=s1.charAt(i); //stores the character of that particular
index
</p>
<p>
</p>
<p>
if(ch=='A'||ch=='E'||ch=='I'||ch=='O'||ch=='U'||ch=='a'||ch=='e'||ch=='i'||c
h=='o'||ch=='u')
</p>
<p>
{
</p>
<p>
vowel++;
</p>
<p>
}
</p>
<p>
}
</p>
<p>
</p>
<p>
for(intj=L;j>=0;j--)
</p>
<p>
ch2=s1.charAt(j); //stores the character of that particular index
</p>
<p>
s2=s2=ch2; // stores the reverse string
</p>
<p>
}
</p>
<p>
System.out.println("total no. of characters:"+L);
</p>
<p>
System.out.println("no. of vowels:"+vowels);
</p>
<p>
System.out.println("reverse string:"+s2);
</p>
<p>
}
</p>
<p>
}
</p>
<p>
</p>
<p>
</p>
Posted at: Tue Jan 26 14:58:30 2010 (GMT)
|
From: khumaan_rocks | Reply 25 of 73 | Reply | |
Subject: Contributed Answer/Explanation to Q. 10 |
Ans
Difference: While is an entry based loop but do while is an exit based loop
Posted at: Sat Feb 6 12:01:01 2010 (GMT)
|
From: jisha | Reply 26 of 73 | Reply | |
Subject: Contributed Answer/Explanation to Q. 25 |
Answer below
import java.io.*;
class Employee1
{
public static void main(String args[])throws IOException
{
DataInputStream in=new DataInputStream(System.in);
System.out.println("Enter the Basic Pay");
int BP=Integer.parseInt(in.readLine());
double DA = 25/100*BP;
double HRA= 15/100*BP;
double PF = 8.33/100*BP;
double NP = BP+DA+HRA;
double GP = NP-PF;
System.out.println("Dearness Allowance is"+DA);
System.out.println("House Rent Allowance is"+HRA);
System.out.println("Provident fund is"+PF);
System.out.println("Net Pay is"+NP);
System.out.println("Gross Pay is"+GP);
}
}
Posted at: Thu Feb 18 15:01:36 2010 (GMT)
|
From: jisha | Reply 27 of 73 | Reply | |
Subject: Contributed Answer/Explanation to Q. 26 |
:-
import java.io.*;
class Vowels2
{
public static void main(String args[])throws IOException
{
DataInputStream in=new DataInputStream(System.in);
System.out.println("Enter the String");
String s=in.readLine();
int len=s.length();
int Vow=0;
for(int i=0;i<len;i++)
{
char ch=s.charAt(i);
if(ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')
++Vow;
}
String rev=" ";
for(int i=len-1;i>=0;i--)
{
rev=rev+s.charAt(i);
}
System.out.println("No of characters"+len);
System.out.println("No of vowels"+Vow);
System.out.println("No of characters"+rev);
}
} Posted at: Thu Feb 18 15:02:54 2010 (GMT)
|
From: jisha | Reply 28 of 73 | Reply | View replies (1)
|
Subject: Contributed Answer/Explanation to Q. 30 |
:-
import java.io.*;
class Bubble25
{
public static void main(String args[])throws IOException
{
DataInputStream in=new DataInputStream(System.in);
int i,j,tmp;
int a[]=new int [5];
System.out.println("Enter the elements");
for(i=0;i<5;i++)
{
a[i]=Integer.parseInt(in.readLine());
}
for(i=0;i<5;i++)
for(j=i+1;j<5;j++)
{
if (a[j]<a[i])
{
tmp=a[i];
a[i]=a[j];
a[j]=tmp;
}
}
System.out.println("Array in order is");
for(j=0;j<5;j++)
{
System.out.println(a[j]);
}
}
}
Posted at: Thu Feb 18 15:04:04 2010 (GMT)
|
From: jisha | Reply 29 of 73 | Reply | |
Subject: Contributed Answer/Explanation to Q. 30 |
:-
import java.io.*;
class Bubble25
{
public static void main(String args[])throws IOException
{
DataInputStream in=new DataInputStream(System.in);
int i,j,tmp;
int a[]=new int [5];
System.out.println("Enter the elements");
for(i=0;i<5;i++)
{
a[i]=Integer.parseInt(in.readLine());
}
for(i=0;i<5;i++)
for(j=i+1;j<5;j++)
{
if (a[j]<a[i])
{
tmp=a[i];
a[i]=a[j];
a[j]=tmp;
}
}
System.out.println("Array in order is");
for(j=0;j<5;j++)
{
System.out.println(a[j]);
}
}
}
Posted at: Thu Feb 18 15:05:47 2010 (GMT)
|
From: omarmirza10 | Reply 30 of 73 | Reply | View replies (1)
|
Subject: Contributed Answer/Explanation to Q. 22 |
Answer:
Posted at: Wed Feb 24 12:31:41 2010 (GMT)
|
From: omarmirza10 | Reply 31 of 73 | Reply | |
Subject: Contributed Answer/Explanation to Q. 22 |
Answer:
l
Posted at: Wed Feb 24 12:32:21 2010 (GMT)
|
From: omarmirza10 | Reply 32 of 73 | Reply | View replies (1)
|
Subject: Contributed Answer/Explanation to Q. 24 |
Answer:
Posted at: Wed Feb 24 12:32:58 2010 (GMT)
|
From: omarmirza10 | Reply 33 of 73 | Reply | |
Subject: Contributed Answer/Explanation to Q. 24 |
Answer:
LowerCase() method changes all the characters to lower case
eg: String x:="SYVUM";
System.out.println(x.LowerCase());
Output: syvum
ViceVersa for UpperCase()
eg:
String x="syvum";
System.out.println(x.UpperCase());
OUTPUT:
SYVUM
Posted at: Wed Feb 24 12:35:41 2010 (GMT)
|
From: dj_glitzzz | Reply 34 of 73 | Reply | |
Subject: Contributed Answer/Explanation to Q. 26 |
:-
import java.io.*;
class input
{
public static void main(String arg[])throws IOException
{
BufferedReader br=new BufferedReader(new
InputStreamReader(System.in));
System.out.println("Enter String:");
String s1=br.readLine( ); //take the input
String s2=""; //create a blank string to store the reverse value
int L=s1.length( ); //store the length
char ch,ch2;
int vowel=0; // create a counter for counting the no. of vowels
for(int i=0;i
{
ch=s1.charAt(i); //stores the character of that particular
index
if(ch=='A'||ch=='E'||ch=='I'||ch=='O'||ch=='U'||ch=='a'||ch=='e'||ch=='i'||c
h=='o'||ch=='u')
{
vowel++;
}
}
for(intj=L;j>=0;j--)
ch2=s1.charAt(j); //stores the character of that particular index
s2=s2=ch2; // stores the reverse string
}
System.out.println("total no. of characters:"+L);
System.out.println("no. of vowels:"+vowels);
System.out.println("reverse string:"+s2);
}
}
Posted at: Fri Feb 26 07:20:16 2010 (GMT)
|
From: omarmirza10 | Reply 35 of 73 | Reply | |
Subject: Contributed Answer/Explanation to Q. 31 |
Answer is below:
<p>
import java.io.*;<br />
public class Q82k5<br />
{<br />
public static void main(String args[])throws IOException<br />
{<br />
<br />
BufferedReader br=new BufferedReader(new
InputStreamReader(System.in));<br />
int negativeNo=0;<br />
int evenNo=0;<br />
int oddNo=0;<br />
int number;<br />
<br />
do<br />
{<br />
System.out.println("Enter the number \n");<br />
number=Integer.parseInt(br.readLine());<br />
if(number>0)<br />
{<br />
if(number%2==0)<br />
{<br />
evenNo=evenNo+number;<br />
}<br />
else<br />
{<br />
oddNo=oddNo+number;<br />
<br />
} <br />
}<br />
else if(number<0)<br />
{<br />
negativeNo=negativeNo+number;<br />
}<br />
}while(number!=0);<br />
<br />
System.out.println("Sum of Positive Even Numbers is "
+evenNo);<br />
System.out.println("Sum of Positive Odd Numbers is "
+oddNo);<br />
System.out.println("Sum of Negative numbers is "
+negativeNo);<br />
<br />
}
</p>
<p>
}
</p>
Posted at: Fri Feb 26 16:15:41 2010 (GMT)
|
From: poulomi24 | Reply 36 of 73 | Reply | |
Subject: Contributed Answer/Explanation to Q. 12 |
30
5*++x
=5*(++x)
=5*(++5)
=5*6
=30
Posted at: Thu Mar 4 15:16:51 2010 (GMT)
|
From: poulomi24 | Reply 37 of 73 | Reply | |
Subject: Contributed Answer/Explanation to Q. 13 |
25
5*x++
=5*(x++)
=5*(5++)
=5*5
=25
Posted at: Thu Mar 4 15:17:45 2010 (GMT)
|
From: madhu_pk | Reply 38 of 73 | Reply | |
Subject: Contributed Answer/Explanation to Q. 1 |
inheritance, polymorphism
Posted at: Tue Mar 23 08:55:12 2010 (GMT)
|
From: abrahamkynadi | Reply 39 of 73 | Reply | |
Subject: Contributed Answer/Explanation to Q. 1 |
Encapsulation & Abstraction
Posted at: Wed Mar 24 12:11:11 2010 (GMT)
|
From: abrahamkynadi | Reply 40 of 73 | Reply | |
Subject: Contributed Answer/Explanation to Q. 8 |
It is a group of statements which consist of declarations and executable
statements
Posted at: Wed Mar 24 12:13:01 2010 (GMT)
|
< Page 2 of 4 > >> |