i have java assignment >>

i need any one to help me to solve it >>

this is my e-mail >>> [email removed]
...............................

Java Assignment 3

1.Use nested loops that print the following pattern:-

A) 1
12
123
1234
12345
123456

2.Write a program to compute the sum and product of all odd integers from 1 to 19.

3.write a program which writes the integers from 1 to 50, replacing every multiple of (5) by the word "OK" and every integer divisible by (11) by the word "FINE"
Ex.
1 2 3 4 OK 6 7 8 9 OK FINE 12 13 14 OK….....

4.Write a program that read a list of numbers from the user, storing them in one dimension array, then prints them in the opposites order.
Example
Input :- 5 8 7 1 12 10 78 14 5 32 15
Output:- 15 32 5 14 78 10 12 1 7 8 5

5.Write a program to find the positions and number of zeros in two dimension array of integer.

6.Write a program that reads a student’s test scores in the range of 50-100. It should then determine the number of students having scores in each of the following ranges: 50-59, 60-69, 70-79, 80-89, 90-100.
Note: use one dimension array to store the students score.

## All 30 Replies

after that reformulate your question

i hava solve the 1st one and the 3rd one but the athor i dont

for loop from 1 to 19
if statement is num%2 == 1
yes, add to sum
no, next number
problem solved

commented: Hah, you are quite the comedian =P +1

Come on now, show some effort. Show us what you have tried in solving those problems, and provide information about what is going wrong with them and we will help you correct them, but we will not do them for you.

1.Use nested loops that print the following pattern:-

A) 1
12
123
1234
12345
123456
>>>>>>>>>>>>>>>>>>>>
the answer is :

``````mport java.util.Scanner;
public class program1 {                              // declaration of class
public static void main ( String [] args ) {       // declaration of main method

for ( int i = 1 ; i <= 6 ; i++ )
{
for ( int x = 1 ; x <= i ; x++ )
{
System.out.print(x);                       //This statement to print X
}
System.out.println();                          // This statement to print a new line
}
}                                                  // end of main method
}                                                    // end of class``````

3.write a program which writes the integers from 1 to 50, replacing every multiple of (5) by the word "OK" and every integer divisible by (11) by the word "FINE"
Ex.
1 2 3 4 OK 6 7 8 9 OK FINE 12 13 14 OK….....
>>>>>>>>>>>>>>>>>>>>>
the answer is :

``````import java.util.Scanner;
public class program3 {                              // declaration of class
public static void main ( String [] args ) {       // declaration of main method

int x ;

for ( x = 1 ;  x <= 50 ;  x++ ) {
if ( x % 5 == 0 )
System.out.print( " Ok " );
else if ( x % 11 == 0 )
System.out.print( " Fine " );
else
System.out.print( " " + x + " " );
}
}
}``````

please i need ur help >>> becuse i have to submit the assignment tomorow ... there is no time >> becuse i need to understand them ... please >>> dont forget me

No one's forgotten you, but it seems as though you have been wasting your time, and us wasting our time to make up for that isn't going to happen.

Show what you have for the other problems and we will help you to correct it, as already said, but we are not going to do it for you.

why u r not helpfull with me >>
there is an idea in this programs but i dont know what is it ...

For 2, what are all even numbers divisible by that odd numbers are not?

For 4, loop backwards.

For 5, nested loops.

For 6, a loop and a an array of length 5 for summing, and divide by 10 and minus 5 to index into it.

There, there are the ideas for each of them.

Us doing your homework for you would not help you. You would learn nothing, and so would come back here tommorrow begging for "help" again, because what you need to do tommorrow built on what you did today, but you didn't do anything today (other than cut-n-paste). That's the way it is, if we simply do it for you, so, no, we are not going to do it for you, that does not help you. Those who fail with effort still understand more than those who pass without it.

thaaaaaaaanx my frind .... i'll do it and i will be back later ...

thaaaaaaaanx for ur advice ....

i'll be back

If you have solved a problem and you run it and it works then don't post it. Post only those that you are having problems with.

hey again >>>

i have solve the second one>>
2. Write a program to compute the sum and product of all odd integers from 1 to 19.

<<<<<<<<<
the answer is :

``````import java.util.Scanner;

public class program1 {
public static void main(String [] args){
Scanner scan =new Scanner(System.in);

int  sum =0, product=1 ;

for (int x = 1; x <= 19; x++) {

if (x % 2 ==1)
sum=sum+x;
}

for (int y = 1; y <= 19; y++) {

if (y % 2 ==1)
product=product*y;
}

System.out.println( sum+"       "+ product );

}

}``````

i dont know if its correct <<<

and the athers i dont understand the real idea >>

but i'll try ....

Does it compile?
Are there any errors?
Is it doing what you expect to do?

And please start using code tags (without spaces inside square brackets)

``````private final String = "For easy readability, always wrap programming code within posts in (code) (code blocks) and (icode) (inline code) tags.";
``````

It could help if you try to go over your program and write a pseudocode and then browse over java tutorials to interpret your pseudocode into java codes....

With a little effort you can answer these problems...

With the exception of that second link which has mainly obsolete, and often times simply bad, tutorials/examples/advice. Roseindia is a blight on the Java world. Nearly everytime I see someone use some really bad practice on many forums and tell them not to do that, they often come back and say "But the tutorial I followed showed it this way!". And where did they get that tutorial ---> Roseindia. Nuff said.

commented: Yes, roseindia is crap +9

With the exception of that second link which has mainly obsolete, and often times simply bad, tutorials/examples/advice. Roseindia is a blight on the Java world. Nearly everytime I see someone use some really bad practice on many forums and tell them not to do that, they often come back and say "But the tutorial I followed showed it this way!". And where did they get that tutorial ---> Roseindia. Nuff said.

Lol...

The site didn't seem organized to me just at first glance. I'll probably never go there again.

I've probably learned more here than I have alone. Dani for the win (yes I spelled it out) =P

/facepalm

I now I feel like an uber noob for going to RoseIndia

Also first link to java2s.com is loose-win situation.
I would not recommend that site to beginner because either they will learn nothing from it as it does not contain any explanation to the code (code there is simple free copy to code from numerous books, some already out of date) or they will just copy&paste without understanding what that thing does.
However I use that site time-to-time, but I think I'm past the learning of for or while loops...

hey again ....

how r u ;
what happen >>> there is no answer ...

any one explain to me in more details the way to solve ...

yes my frinds ...

1. Start using proper English, if English is your second language
• Use dictionary
• Use in build spell checker of Firefox
2. @what happen >>> there is no answer ... , so where is your problem and how did you try to solve it?

PS: Would be nice if in every post you summarize what still needs to be done. It is unlike situation that people will go through all you posts...

i tried more than one but i dont know how to solve it >>>

i feel booooooooooooooring

Well you just round it up all nicely as I asked...
You do not feel boring, but bored. However in my opinion you are lazy expecting us to do your home works so you can pass module. Too bad

Well i decided to do his homework, but in jsp because I was bored. BTW don't think professors does not check here so copy cat code will make you fail the class

``````<%

out.print("<BR>QUESTION 1<BR>");
int numbertoreach = 6;

for (int i  = 1; i <= numbertoreach; i++)
{
for (int j = 1; j <= i; j++)
{
out.print(j);
}
out.print("<BR>");
}

out.print("<BR>QUESTION 2<BR>");
int oddtoreach = 19;
int sum = 0;
for (int i = 1; i <= oddtoreach; i+=2)
{
sum += i;
}
out.print(sum);

out.print("<BR>QUESTION 3<BR>");
for (int i = 1; i <= 50; i++)
{
if (i%5 == 0)
out.print("OK ");
else if (i%11 == 0)
out.print("FINE ");
else
out.print(i + " ");
}

out.print("<BR>QUESTION 4<BR>");
String input = "5 8 7 1 12 10 78 14 5 32 15";
String[] onedemensionarray = input.split(" ");
for (int i = onedemensionarray.length-1; i >= 0; i--)
{
out.print(onedemensionarray[i] + " ");
}

out.print("<BR>QUESTION 5<BR>");
int arraywidth = 10;
int arrayheight = 10;
int[][] twodemensionarray = new int[arraywidth][arrayheight];
// Fill the array with random values
for (int i = 0; i < arraywidth; i++)
{
for (int j = 0; j < arrayheight; j++)
{
twodemensionarray[i][j] = (int)(Math.random()*10);
}
}

// Output current array
for (int i = 0; i < arraywidth; i++)
{
for (int j = 0; j < arrayheight; j++)
{
out.print(twodemensionarray[i][j] + " ");
}
out.print("<BR>");
}

// Output where 0 are
for (int i = 0; i < arraywidth; i++)
{
for (int j = 0; j < arrayheight; j++)
{
if (twodemensionarray[i][j] == 0)
out.print("0 at: " + j + "," + i + "<BR>");
}
}

out.print("<BR>QUESTION 6<BR>");
String inputofscores = "10 21 12 32 43 12 60 12 31 10 40 50 60 70 10 23 12 21 40 85 71 61 95";
String[] scores = inputofscores.split(" ");
double[] allscores = new double[scores.length];
for (int i = 0; i < scores.length; i++)
{
allscores[i] = Double.valueOf(scores[i]);
}
int from50to100 = 0;
int from50to59 = 0;
int from60to69 = 0;
int from70to79 = 0;
int from80to89 = 0;
int from90to100 = 0;
for (int i = 0; i < allscores.length; i++)
{
if (allscores[i] >= 50 && allscores[i] <= 100)
{
from50to100++;
if (allscores[i] >=50 && allscores[i] <= 59)
from50to59++;
else if (allscores[i] >=60 && allscores[i] <= 69)
from60to69++;
else if (allscores[i] >=70 && allscores[i] <= 79)
from70to79++;
else if (allscores[i] >=80 && allscores[i] <= 89)
from80to89++;
else if (allscores[i] >=90 && allscores[i] <= 100)
from90to100++;
}
}
out.print("Scores of 50 - 100: " + from50to100 + "<BR>");
out.print("Scores of 50 - 59: " + from50to59 + "<BR>");
out.print("Scores of 60 - 69: " + from60to69 + "<BR>");
out.print("Scores of 70 - 79: " + from70to79 + "<BR>");
out.print("Scores of 80 - 89: " + from80to89 + "<BR>");
out.print("Scores of 90 - 100: " + from90to100 + "<BR>");

%>``````

i tried more than one but i dont know how to solve it >>>

i feel booooooooooooooring

common man , we are like to help you !

TheBuzzer : you did something nasty ! that makes the ppl lazy . I have added more rep to my account because taling like these issues . anyway doesn't matter.

zoooz_20: That is no matter that you finish the homework or not . Your ProfeSxor is not a evil and just dont worry about yur homework , but dont give up your challange

now explain where did you stuck . with the source codes and everything ! post in detail
is really a not problem , but showing the layzyness or the stupidness is really a problem in a form like this .

zoo: try this out , and post where did you stuck ?

common man , we are like to help you !

TheBuzzer : you did something nasty ! that makes the ppl lazy . I have added more rep to my account because taling like these issues . anyway doesn't matter.

zoooz_20: That is no matter that you finish the homework or not . Your ProfeSxor is not a evil and just dont worry about yur homework , but dont give up your challange

now explain where did you stuck . with the source codes and everything ! post in detail
is really a not problem , but showing the layzyness or the stupidness is really a problem in a form like this .

zoo: try this out , and post where did you stuck ?

his prob trying to figure out how to get my code to work now. Most likely he won't come back here until he got another question.

hi again >>>

this web site 4 IT descussion >>

that mean if any 1 have any problem >>> u have to help him ...

thank u @ll for help >>>

i promis @ll of u to be a member in this web ,,
and i'm sorry 4 any noise ..

commented: No one owes you anything. All help here is completely voluntary and your attitude may lessen the help you get. -2

hi again >>>

this web site 4 IT descussion >>

that mean if any 1 have any problem >>> u have to help him ...

thank u @ll for help >>>

i promis @ll of u to be a member in this web ,,
and i'm sorry 4 any noise ..

"u have to help him ..."

Wrong, pal. No one HAS to do anything. This is all strictly voluntary. No one gets paid here, so everyone picks and chooses who to help. A big part of that choice is deciding who has put in effort and who hasn't. People who show effort get more help. People who whine and demand and use an overabundance of leet-speak are ignored.

commented: I tried so hard not to laugh... but I failed XD +2

Vernon is completely correct. We volunteer our time helping people out as we see fit. Your current posting trend is leading you towards less help, not more.

commented: Here's some rep for agreeing with me :) and because you've written some good posts that I haven't given you rep for yet. :) +5
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.