Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.help > #2521 > unrolled thread
| Started by | "Sara M." <kasra.song@gmail.com> |
|---|---|
| First post | 2013-02-21 10:30 -0800 |
| Last post | 2013-02-24 00:17 -0800 |
| Articles | 6 — 5 participants |
Back to article view | Back to comp.lang.java.help
Helpppp plzzz "Sara M." <kasra.song@gmail.com> - 2013-02-21 10:30 -0800
Re: Helpppp plzzz Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-02-21 13:57 -0500
Re: Helpppp plzzz Roedy Green <see_website@mindprod.com.invalid> - 2013-02-21 18:13 -0800
Re: Helpppp plzzz Lew <lewbloch@gmail.com> - 2013-02-21 18:31 -0800
Re: Helpppp plzzz Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-02-22 10:00 -0800
Re: Helpppp plzzz Roedy Green <see_website@mindprod.com.invalid> - 2013-02-24 00:17 -0800
| From | "Sara M." <kasra.song@gmail.com> |
|---|---|
| Date | 2013-02-21 10:30 -0800 |
| Subject | Helpppp plzzz |
| Message-ID | <6764b4a4-d242-410a-9a1e-603b0a7f5695@googlegroups.com> |
Hi guys ,
I am taking C.T.S this semester and I am stuck pleaseee help me..
Okay so there is this assignment from the blue pelican called mixed results
and says the following :
Project… Mixed Results
Create a new project called MixedResults with a class called Tester. Within the main method
of Tester you will eventually printout the result of the following problems. However, you
should first calculate by hand what you expect the answers to be. For example, in the
parenthesis of the first problem, you should realize that strictly integer arithmetic is taking
place that results in a value of 0 for the parenthesis.
double d1 = 37.9; //Initialize these variables at the top of your program
double d2 = 1004.128;
int i1 = 12;
int i2 = 18;
Problem 1: 57.2 * (i1 / i2) +1
Problem 2: 57.2 * ( (double)i1 / i2 ) + 1
Problem 3: 15 – i1 * ( d1 * 3) + 4
Problem 4: 15 – i1 * (int)( d1 * 3) + 4
Problem 5: 15 – i1 * ( (int)d1 * 3) + 4
So I wrote this in Netbeans but I get the error expected !!
this is what i wrote in netbeans !!
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package mixedresults;
/**
*
* @author •SaRa•
*/
public class Tester {
public static void main(String []args)
{
final double d1=37,9;
double d1 = 37.9;
double d2=1004,128;
int i1=12;
int i2=18;
Problem 1: 57.2*(i1/i2)+1;
Problem 2: 57.2*((double)i1/i2)+1;
Problem 3: 15-i1*(d1*3)+4;
Problem 4: 15-i1*(int)(d1*3)+4;
Problem 5: 15-i1*((int)dl*3)+4;
}
}
[toc] | [next] | [standalone]
| From | Eric Sosman <esosman@comcast-dot-net.invalid> |
|---|---|
| Date | 2013-02-21 13:57 -0500 |
| Message-ID | <kg5ql0$7ih$1@dont-email.me> |
| In reply to | #2521 |
On 2/21/2013 1:30 PM, Sara M. wrote:
> [...]
> package mixedresults;
>
> /**
> *
> * @author •SaRa•
> */
> public class Tester {
>
> public static void main(String []args)
> {
> final double d1=37,9;
Did you mean `37.9' instead of `37,9'? Java follows the
American practice of using `.' instead of `,' between the
integer and fraction parts.
Once you fix that problem, though, there's more:
> double d1 = 37.9;
This defines a variable named `d1', but a `d1' variable
has already been defined -- You can't define a second `d1'
here. Either fix the first line and delete this one, or
delete the first line.
> double d2=1004,128;
Same `.' vs. `,' problem as before.
> int i1=12;
> int i2=18;
>
> Problem 1: 57.2*(i1/i2)+1;
> Problem 2: 57.2*((double)i1/i2)+1;
> Problem 3: 15-i1*(d1*3)+4;
> Problem 4: 15-i1*(int)(d1*3)+4;
> Problem 5: 15-i1*((int)dl*3)+4;
These five lines aren't Java; they're just copied from
the problem statement. Apparently the intent is for you to
write Java statements that perform these calculations (and
print the results, probably). If you run into trouble writing
those statements, post what you've tried along with any error
messages you get, and someone will try to help you.
> }
>
> }
>
--
Eric Sosman
esosman@comcast-dot-net.invalid
[toc] | [prev] | [next] | [standalone]
| From | Roedy Green <see_website@mindprod.com.invalid> |
|---|---|
| Date | 2013-02-21 18:13 -0800 |
| Message-ID | <dvkdi8pcdmqjba6g8c2btdltjb584r3q82@4ax.com> |
| In reply to | #2521 |
On Thu, 21 Feb 2013 10:30:08 -0800 (PST), "Sara M." <kasra.song@gmail.com> wrote, quoted or indirectly quoted someone who said : >his is what i wrote in netbeans !! You have to ask a question. See http://mindprod.com/newsgroups.html -- Roedy Green Canadian Mind Products http://mindprod.com The generation of random numbers is too important to be left to chance. ~ Robert R. Coveyou (born: 1915 died: 1996-02-19 at age: 80)
[toc] | [prev] | [next] | [standalone]
| From | Lew <lewbloch@gmail.com> |
|---|---|
| Date | 2013-02-21 18:31 -0800 |
| Message-ID | <69ebb166-449a-4c12-982a-bf596aff43f2@googlegroups.com> |
| In reply to | #2524 |
On Thursday, February 21, 2013 6:13:04 PM UTC-8, Roedy Green wrote: > You have to ask a question. See http://mindprod.com/newsgroups.html She did, implicitly. Surely you figured that out. However, she would benefit more from http://www.catb.org/esr/faqs/smart-questions.html Lady, "pleaseeee" is not a word, it's a whine (on the silent "e" no less). "Helpppp" and "plzzz" are also not words. You don't even usually need exclamation points, let alone several in a row. Read the Java tutorials. You're supposed to try to learn the language first, then try to write code in accordance with the language's rules. You have not yet even tried to make your code look like Java, let alone to write valid Java. http://docs.oracle.com/javase/tutorial/ Study. Learn. Do. Share the knowledge. -- Lew
[toc] | [prev] | [next] | [standalone]
| From | Daniel Pitts <newsgroup.nospam@virtualinfinity.net> |
|---|---|
| Date | 2013-02-22 10:00 -0800 |
| Message-ID | <4nOVs.19262$mC2.2763@newsfe29.iad> |
| In reply to | #2521 |
On 2/21/13 10:30 AM, Sara M. wrote: > Hi guys , > I am taking C.T.S this semester and I am stuck pleaseee help me.. There are zero z's, and only two e's in the word please. Also, help only has one p. You may be under the impression that repeating letters add emphasis to your desire to be helped. If it adds anything, its a sense of whining. My young daughter knows that whining is the surest way to *not* get any help. This abuse of the language also creates the impression that you can't take the time to think carefully about a problem, and that you want us just to do your homework for you. Hopefully you've left plenty of time to solve the homework yourself, because on this group you'll find only suggestions on how to approach the problem, not actual solutions. This is for your own good. We've all done this homework before. Us doing it for you serves no one. Tell us what you've tried. Provide an SSCCE if applicable. Tell us what part of the failure you've encountered, and what you think it should be doing. Yes, we need you to think yourself. We can help you to think differently, but only if we know how you think. Good luck. Daniel.
[toc] | [prev] | [next] | [standalone]
| From | Roedy Green <see_website@mindprod.com.invalid> |
|---|---|
| Date | 2013-02-24 00:17 -0800 |
| Message-ID | <f1jji81i125o2d741u6bkd7ckdstf3npgf@4ax.com> |
| In reply to | #2521 |
On Thu, 21 Feb 2013 10:30:08 -0800 (PST), "Sara M." <kasra.song@gmail.com> wrote, quoted or indirectly quoted someone who said : > Problem 1: 57.2*(i1/i2)+1; > Problem 2: 57.2*((double)i1/i2)+1; > Problem 3: 15-i1*(d1*3)+4; > Problem 4: 15-i1*(int)(d1*3)+4; > Problem 5: 15-i1*((int)dl*3)+4; =20 This does not look much like Java. You can't use spaces in labels. You must print out expressions or put them in variables. Just computing them is nearly always pointless. -- Roedy Green Canadian Mind Products http://mindprod.com The generation of random numbers is too important to be left to chance. ~ Robert R. Coveyou (born: 1915 died: 1996-02-19 at age: 80)
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.help
csiph-web