NY Regents Exam   Teasers   IQ Tests   Chemistry   Biology   GK   C++   Recipes   Search <  a href="/cgi/members/home.cgi" class="toplink">Members   Sign off

## Discussion topic: Contributed Answer/Explanation to Q. 12

#### Viewing messages

To go to the homepage of this topic, click here.
 <<  <  Page 4 of 4 From: krutika Reply 61 of 73 Reply Subject: Contributed Answer/Explanation to Q. 27 ``` program class shapes { public void area1(int r) { double a=r*r*3.14; System.out.println("area of circle"+a); } public void area2(int l,int b) { int b=l*b; System.out.println("area of rectangle"+b); } public void area3(int s) { int c=4*s; System.out.println("area of square"+c); }} ```Posted at: Tue Oct 26 14:35:42 2010 (GMT) From: bharat03 Reply 62 of 73 Reply Subject: Contributed Answer/Explanation to Q. 15 ``` break is used to force immediate termination of a loop.continue is used to continue running the loop but to stop processing the remainder code in its body for a particular iteration ```Posted at: Thu Oct 28 08:19:21 2010 (GMT) From: angel118 Reply 63 of 73 Reply Subject: Contributed Answer/Explanation to Q. 31 ``` import java.io.*; ```Posted at: Thu Dec 16 15:40:02 2010 (GMT) From: angel118 Reply 64 of 73 Reply View replies (2) Subject: Contributed Answer/Explanation to Q. 31 ``` import java.io.*; ```Posted at: Thu Dec 16 15:40:02 2010 (GMT) From: angel118 Reply 65 of 73 Reply Subject: Contributed Answer/Explanation to Q. 31 ``` the code is written in the explanation

import java.io.*;

class SumOfNumbers

public static void main(String args[])

throws IOException

{

int num;

double sumNegative=0,sumPosEven=0,sumPosOdd=0;

do

{

System.out.println("Enter  the number: ");

if(num<0)

sumNegative+=num;

else if(num%2==0  && num>0)

SumPosEven+=num;

else

sumPosOdd+=num;

}while(num!=0);

< p>System.out.println("Sum of negative integers: "+sumNegative);

System.out.println("Sum of positive even integers: "+sumPosEven);

System.out.println("Sum of positive odd integers: "+sumPosOdd);

}
}
```Posted at: Thu Dec 16 15:45:09 2010 (GMT) From: angel118 Reply 66 of 73 Reply Subject: Contributed Answer/Explanation to Q. 31 ``` the code is written in the explanation

import java.io.*;

class SumOfNumbers

public static void main(String args[])

throws IOException

{

int num;

double sumNegative=0,sumPosEven=0,sumPosOdd=0;

do

{

System.out.println("Enter  the number: ");

if(num<0)

sumNegative+=num;

else if(num%2==0  && num>0)

SumPosEven+=num;

else

sumPosOdd+=num;

}while(num!=0);

< p>System.out.println("Sum of negative integers: "+sumNegative);

System.out.println("Sum of positive even integers: "+sumPosEven);

System.out.println("Sum of positive odd integers: "+sumPosOdd);

}
}
```Posted at: Thu Dec 16 15:45:35 2010 (GMT) From: akhila49 Reply 67 of 73 Reply Subject: Contributed Answer/Explanation to Q. 30 ``` the answer is done in explanation class ascending { int a{5,3,8,4,9,2,1,12,98,16}; int len; ascending() { len=0; } public void main() { len=a.length; for(i=0;ia[j]) { a[i]=a[j]; a[j]=temp; temp=a[i]; } } } } public void main1() { for(int i;i0&&n%2==0)even=even+n;if (n>0&&n%2!=0)odd=odd+n;if(n<0)neg=neg+n; } System.out.printl n("sum of positive even numbers="+even);System.out.println("sum of positive odd numbers="+odd);System.out.println("sum of negative numbers="+neg); } } ```Posted at: Mon Jan 31 14:44:57 2011 (GMT) From: lokeshc Reply 71 of 73 Reply View replies (2) Subject: Contributed Answer/Explanation to Q. 32 ``` ANSWER class name ```Posted at: Sun Feb 13 02:02:39 2011 (GMT) From: lokeshc Reply 72 of 73 Reply Subject: Contributed Answer/Explanation to Q. 32 ``` ANSWER class name { public void search(String a) ```Posted at: Sun Feb 13 02:05:41 2011 (GMT) From: lokeshc Reply 73 of 73 Reply Subject: Contributed Answer/Explanation to Q. 32 ``` ANSWER class name { public void search(String a) { int e; String c[] = {"Ab ","Cd","Ef","Gh","Ij"}; String b[] = {"12","45","90","87","76"} ; for( e=0;e<5;e++) { if(a.equals(c[e])) { System.out.println("Search Successful"); System.out.println(c[e]+" "+b[e]); else System.out.println("Seach unsuccessful.Name not enlisted."); } } } ```Posted at: Sun Feb 13 02:11:17 2011 (GMT) <<  <  Page 4 of 4

To post to this forum, you must be signed in as a Syvum member. Please sign in / register as a member.