[Show all top banners]

jerrybhoot
Replies to this thread:

More by jerrybhoot
What people are reading
Subscribers
:: Subscribe
Back to: Kurakani General Refresh page to view new replies
 Help wanted with JAVA
[VIEWED 7493 TIMES]
SAVE! for ease of future access.
Posted on 10-06-08 6:53 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Guys can you help me write this program. Thanx in advance. I want to thank you again tech guy.
jerrybhoot

 a Java application that prints the following table using the sqrt ( ) method in the Math class using a for loop to produce the output results.

Number    SquareRoot
0    0.0000
2    1.4142
4    2.0000
6    2.4495
8    2.8284
10    3.1623
12    3.4641
14    3.7417
16    4.0000
18    4.2426
20    4.4721


 
Posted on 10-06-08 7:09 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Piggyback ride is not always a viable alternative.
In other words if you cant be bothered to do that on your own
dont bother with java or any form of programming.

 
Posted on 10-06-08 7:19 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

You seems to be very begineer in java. Try to research on internet before asking anyone for help. 
It's too simple problem. Anyway here's simple for loop that will generate table upto 100.

for(int i=0;i<100;i+=2){
 System.out.println(i+"\t\t"+Math.sqrt(i));
}


 
Posted on 10-06-08 7:19 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

 

Last edited: 06-Oct-08 07:20 PM

 
Posted on 10-06-08 11:15 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

/* Use System.out.format to maintain the precision of the double value */
/* Try to read books like Core Java Vol 1, if u are a beginner. */

public class SquareRoot {
    public static void main(String[] args) {
        System.out.println("Number \t SquareRoot");
        for (int i = 0; i <= 20; i = i + 2) {
            System.out.format("%d \t %1.4f \n", i, Math.sqrt(i));
        }
    }
}

/* Output */
/*
Number      SquareRoot
0      0.0000
2      1.4142
4      2.0000
6      2.4495
8      2.8284
10      3.1623
12      3.4641
14      3.7417
16      4.0000
18      4.2426
20      4.4721
*/


 
Posted on 10-06-08 11:16 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

/* Use System.out.format to maintain the precision of the double value */
/* Try to read books like Core Java Vol 1, if u are a beginner. */

public class SquareRoot {
    public static void main(String[] args) {
        System.out.println("Number \t SquareRoot");
        for (int i = 0; i <= 20; i = i + 2) {
            System.out.format("%d \t %1.4f \n", i, Math.sqrt(i));
        }
    }
}

/* Output */
/*
Number      SquareRoot
0      0.0000
2      1.4142
4      2.0000
6      2.4495
8      2.8284
10      3.1623
12      3.4641
14      3.7417
16      4.0000
18      4.2426
20      4.4721
*/


 
Posted on 10-07-08 8:17 AM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

I hope Jerry bhoot has enough help with " khai k khai k" 's solution.

Don't forget to remove the */ and /* Coz I know you are going to copy the whole damn thing and say it does not work. I agree with divdude, abt piggyback thing.

 
Posted on 10-07-08 8:19 AM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

I hope Jerry bhoot has enough help with " khai k khai k" 's solution.

Don't forget to remove the */ and /* Coz I know you are going to copy the whole damn thing and say it does not work. I agree with divdude, abt piggyback thing.

 
Posted on 10-07-08 8:19 AM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

I hope Jerry bhoot has enough help with " khai k khai k" 's solution.

Don't forget to remove the */ and /* Coz I know you are going to copy the whole damn thing and say it does not work. I agree with divdude, abt piggyback thing.

 
Posted on 10-07-08 8:34 AM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

i think its not a good way to  post someone's school homework in sajha. this will discourage to student doing hardwrok. i dont meant to say dont help at all but instead to giving a whole program code, you guys can just post pseudocode for program or just give a concept.

thanks anyway. we are really great to have  a programmers like you.


 
Posted on 10-07-08 3:35 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

I think the original author is vanished. I hope he has not dropped the Java class yet. Only suggestions I have to you is: READ THE BOOK AND LISTEN CLASS LECTURES CAREFULLY before you go out there, seeking for help. 

First, recognize what you need to know to solve the excercise you're given.  You already got the solution; however, if you look at your exercise carefully, you know that it needs some lessons on basic Java class syntax, different types of LOOP in Java, and use of math function library. Very simple! Not a rocket science. So, open your book and read it.

If you don't know fundamentals of programming language, then read the book again from the beginning. Know how a program is created, complied, and executed. Try to take advantage of debugger that comes with the editor you use. Don’t give up just because you get some discouraging comments from some people.  Call it a quit only when your heart tells you to quit.  

 


 


Please Log in! to be able to reply! If you don't have a login, please register here.

YOU CAN ALSO



IN ORDER TO POST!




Within last 30 days
Recommended Popular Threads Controvertial Threads
TPS Re-registration case still pending ..
and it begins - on Day 1 Trump will begin operations to deport millions of undocumented immigrants
ढ्याउ गर्दा दसैँको खसी गनाउच
To Sajha admin
Travel Document for TPS (approved)
All the Qatar ailines from Nepal canceled to USA
NOTE: The opinions here represent the opinions of the individual posters, and not of Sajha.com. It is not possible for sajha.com to monitor all the postings, since sajha.com merely seeks to provide a cyber location for discussing ideas and concerns related to Nepal and the Nepalis. Please send an email to admin@sajha.com using a valid email address if you want any posting to be considered for deletion. Your request will be handled on a one to one basis. Sajha.com is a service please don't abuse it. - Thanks.

Sajha.com Privacy Policy

Like us in Facebook!

↑ Back to Top
free counters