944,030 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 790
  • Java RSS
Nov 4th, 2009
-3

plllllzzz hellp me before next Suterday

Expand Post »
hi guyz and GiRlzz (F) ;;

how R u ?

plllz I need 4 helpping from u !!

I've a Q in Java ,, I'm trying to write it in jGRASP but I can't :s

plllllzzz hellp me before next Suterday ;s

this is my Q


3.Write expressions to compute both solutions for the quadratic formula. The formula is
- b + - ( b^2 - 4ac) / 2a
The - & + symbol means “plus or minus” and indicates that the equation has two solutions: one in which the result of the square root is added to -b and one in which the result is subtracted from -b. Assume all variables are float variables.

this is my answer but when put it in jGRASP , it tell me ERROR !!!

Java Syntax (Toggle Plain Text)
  1. import java.lang.Math;
  2.  
  3. public class E3
  4. {
  5. public static void main(String[] args)
  6. {
  7. Scanner console = new Scanner (System.in);
  8.  
  9. float x,y,a,b,c,f;
  10. double e;
  11.  
  12. System.out.println("Enter a ");
  13. a =console.nextDouble();
  14.  
  15. System.out.println("Enter b ");
  16. b = console.nextDouble();
  17.  
  18. System.out.println("Enter c ");
  19. c = console.nextDouble();
  20.  
  21. f= (b*b)-(4*a*c);
  22. e= Math.pow(f, 0.5 );
  23.  
  24. x=(-b + e)/(2*a);
  25. y=(-b - e)/(2*a);
  26.  
  27. System.out.println("solution1 =" + x);
  28. System.out.println("solution2 =" + y);
  29. }
  30. }



and this is another Q

2.Write a java program that reads two integers into the variables a and b then swaps the values of a and b.


I'm so sorry :;s
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
GiRL,IT is offline Offline
12 posts
since Nov 2009
Nov 4th, 2009
0
Re: plllllzzz hellp me before next Suterday
Can you please brief us on the error that you are getting.
Reputation Points: 8
Solved Threads: 13
Junior Poster
anuj576 is offline Offline
180 posts
since Jul 2008
Nov 4th, 2009
0
Re: plllllzzz hellp me before next Suterday
I notice you are using the standard float numbers and the newer double format which may be the cause of your problems. If so, you may need to cast the double values input into FLOAT to asign them to the declared variables. Alternatively, you could use Double precision throughout the program.
Reputation Points: 23
Solved Threads: 6
Light Poster
stevelg is online now Online
33 posts
since Oct 2009
Nov 4th, 2009
0
Re: plllllzzz hellp me before next Suterday
Click to Expand / Collapse  Quote originally posted by GiRL,IT ...

2.Write a java program that reads two integers into the variables a and b then swaps the values of a and b.
java Syntax (Toggle Plain Text)
  1.  
  2. public class swapInts
  3. {
  4. public static void main(String[] args)
  5. {
  6. Scanner console = new Scanner (System.in);
  7.  
  8. int a, b, tempInt;
  9.  
  10. System.out.println("Enter first Int: ");
  11. a =console.nextInt();
  12.  
  13. System.out.println("Enter second Int: ");
  14. b = console.nextInt();
  15.  
  16. tempInt = a; //copy a to temp
  17. a = b; //copy b to a
  18. b = tempInt; //copy temp to b
  19.  
  20. System.out.println("int 1=" + a);
  21. System.out.println("int 2 =" + b);
  22. }
  23. }

hope this helps...
Reputation Points: 9
Solved Threads: 0
Newbie Poster
mruthyunjaya is offline Offline
5 posts
since Nov 2009
Nov 6th, 2009
-2
Re: plllllzzz hellp me before next Suterday
anuj576 & stevelg

THX 4 u ,, I solved Q 3 and I knw where is my erorr ^^



mruthyunjaya

Thhhhhhhhhhhhhhhnk u

you've helped me thhhx huuuun (F)(F) u'r a heRo


I'v a Q

what's meaning of tempInt in

Java Syntax (Toggle Plain Text)
  1. int a, b, tempInt;
  2. tempInt = a; //copy a to temp
  3. b = tempInt; //copy temp to b


Finelly ^^ R u sure from da code ?

thx again
Last edited by GiRL,IT; Nov 6th, 2009 at 3:40 am.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
GiRL,IT is offline Offline
12 posts
since Nov 2009
Nov 6th, 2009
0
Re: plllllzzz hellp me before next Suterday
@GiRL,IT your use of language is unacceptable. Please make sure you read forum rules where you will find something like
Quote ...
We strongly encourage all posts to be in full-sentence English. Please do not use "leet" speak or "chatroom" speak.
Moderator
Featured Poster
Reputation Points: 2786
Solved Threads: 874
Code tags enforcer
peter_budo is offline Offline
6,658 posts
since Dec 2004
Nov 6th, 2009
-1
Re: plllllzzz hellp me before next Suterday
^

okay dear .

I'll do That
Last edited by GiRL,IT; Nov 6th, 2009 at 4:43 am.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
GiRL,IT is offline Offline
12 posts
since Nov 2009
Nov 6th, 2009
0
Re: plllllzzz hellp me before next Suterday
Click to Expand / Collapse  Quote originally posted by GiRL,IT ...
mruthyunjaya

Thhhhhhhhhhhhhhhnk u

you've helped me thhhx huuuun (F)(F) u'r a heRo


I'v a Q

what's meaning of tempInt in

Java Syntax (Toggle Plain Text)
  1. int a, b, tempInt;
  2. tempInt = a; //copy a to temp
  3. b = tempInt; //copy temp to b


Finelly ^^ R u sure from da code ?

thx again
tempInt is just a temporary Integer. we use that to store either a or b value in the process of swapping... hope i am clear..
Reputation Points: 9
Solved Threads: 0
Newbie Poster
mruthyunjaya is offline Offline
5 posts
since Nov 2009
Nov 6th, 2009
0
Re: plllllzzz hellp me before next Suterday
^

thank you

yes ,you could clear for me
Reputation Points: 10
Solved Threads: 0
Newbie Poster
GiRL,IT is offline Offline
12 posts
since Nov 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: default contructor?
Next Thread in Java Forum Timeline: Merge file program compiles but not run.





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC