Need help in Java!!

davidktw

Arch-Supremacy Member
Joined
Apr 15, 2010
Messages
13,547
Reaction score
1,301
Hi, i need some help from experts here for java.

1. How do i write so my program will take in 10 inputs from user and sort them in descending order?
2. Explain OOP and its features with examples of relevant java program.
3. Given n, the pattern contains n lines. The pattern contains asterisks and spaces alternately. The

sum of asterisks and spaces in each line is equal to n. The character at row i and column j is an

asterisk if i+j is an even number. Else, it is a space.

Write a program that takes a command-line argument N and prints an N-by-N pattern like the

one below.


Thanks for your time.

What is your contribution to the question? Have u tried attempting the question? Please don't ask is here to do your question. We are not earning your cert.

Show us what you have done and then we help u on the way
 

j.kaii

Member
Joined
Sep 7, 2012
Messages
120
Reaction score
0
What is your contribution to the question? Have u tried attempting the question? Please don't ask is here to do your question. We are not earning your cert.

Show us what you have done and then we help u on the way

ok. For the first question i have done it in the pic attached. It will only save the 1st and 2nd input but will not save the rest.


For 2nd and 3rd question i have no ideas of whats going on. Maybe you can tell me the concept i will do the coding.

Thanks
 

jittery

Arch-Supremacy Member
Joined
Dec 31, 2003
Messages
10,875
Reaction score
1
Hi, i need some help from experts here for java.

1. How do i write so my program will take in 10 inputs from user and sort them in descending order?
2. Explain OOP and its features with examples of relevant java program.
3. Given n, the pattern contains n lines. The pattern contains asterisks and spaces alternately. The

sum of asterisks and spaces in each line is equal to n. The character at row i and column j is an

asterisk if i+j is an even number. Else, it is a space.

Write a program that takes a command-line argument N and prints an N-by-N pattern like the

one below.


Thanks for your time.

3)
for(int i=0; i< n; i++){
for(int j=0; j<n; j++){
if((i+j)%2 == 0){
//print *
}
else print ' ';
}
}

1) your attached picture so small who can see?
 

j.kaii

Member
Joined
Sep 7, 2012
Messages
120
Reaction score
0
sorry i cant upload full size with imageshack as im not upgraded. maybe you can save the image file and zoom?
 

davidktw

Arch-Supremacy Member
Joined
Apr 15, 2010
Messages
13,547
Reaction score
1,301
ok. For the first question i have done it in the pic attached. It will only save the 1st and 2nd input but will not save the rest.


For 2nd and 3rd question i have no ideas of whats going on. Maybe you can tell me the concept i will do the coding.

Thanks

I don't even understand what you are doing for question 1.

If the question asked for you to take 10 inputs from your user, why don't you use ask the user to enter 10 integers separated by whitespace. Then use your scanner and scan 10 times, put the 10 values into a 10 elements integer array and apply the sorting algorithm on the array ?

Question 2 is something you should go and read up. If I explain to you what is OOP, then what more do you need to explain ? Which school are you studying and why ain't you able to answer question 2 yourself ?

Question 3

Basically given a number N, a 2D pattern provided to you will have N rows and N columns. The pattern is made up of asterisk(*) and space( ).

You are told to print out such a 2D pattern where at position(j, i) in the 2D pattern, it will be an asterisk(*) if at row i and column j, i+j is an even number (divisible by 2) or space( ) if i+j is odd (not divisible by 2).

I think I have made the question a lot more clearer for you to understand.
 
Important Forum Advisory Note
This forum is moderated by volunteer moderators who will react only to members' feedback on posts. Moderators are not employees or representatives of HWZ Forums. Forum members and moderators are responsible for their own posts. Please refer to our Community Guidelines and Standards and Terms and Conditions for more information.
Top