Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.help > #2546 > unrolled thread

Im stuck :-s plz help again LOL

Started by"Sara M." <kasra.song@gmail.com>
First post2013-02-24 17:18 -0800
Last post2013-02-24 22:26 -0500
Articles 5 — 3 participants

Back to article view | Back to comp.lang.java.help


Contents

  Im stuck :-s plz help again LOL "Sara M." <kasra.song@gmail.com> - 2013-02-24 17:18 -0800
    Re: Im stuck :-s plz help again LOL Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-02-24 20:36 -0500
      Re: Im stuck :-s plz help again LOL "Sara M." <kasra.song@gmail.com> - 2013-02-24 17:44 -0800
        Re: Im stuck :-s plz help again LOL markspace <markspace@nospam.nospam> - 2013-02-24 18:06 -0800
        Re: Im stuck :-s plz help again LOL Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-02-24 22:26 -0500

#2546 — Im stuck :-s plz help again LOL

From"Sara M." <kasra.song@gmail.com>
Date2013-02-24 17:18 -0800
SubjectIm stuck :-s plz help again LOL
Message-ID<74bb5922-3b7d-4d38-8231-e4d69647ad44@googlegroups.com>
okay so I have this assignment and 

this is what they want from me :


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



Your printout should look like the following:
Problem 1: 1.0
Problem 2: 39.13333333333333
Problem 3: -1345.39999999999
Problem 4: -1337
Problem 5: -1313


and I dont know how to get that !!! 

this is what I write in Netbeans :



public class Tester {
      
    public static void main(String []args)
 {
     
     
     double d1 = 37.9; //Initialize these variables at the top of your program
     double d2 = 1004.128;
     int i1 = 12;
     int i2 = 18;
         
     final double PROGRAM1=57.2 * (i1 / i2) +1;
     final double PROGRAM2=57.2 * ( (double)i1 / i2 ) + 1;
     final double PROGRAM3=15 – i1 * ( d1 * 3) + 4;
     final double PROGRAM4=15 – i1 * (int)( d1 * 3) + 4;
     final double PROGRAM5=15 – i1 * ( (int)d1 * 3) + 4;
     
}
    
}


but it is wrong so can someone tell me how to get the above print they are expecting !! and I have another question  ,


Create a new project called ArithmeticAssignment with a class called Tester that will calculate
and print the results of the following arithmetic problems:


79 + 3 * (4 + 82 –68) – 7 +19
(179 +21 +10) / 7 + 181
10389 * 56 * 11 + 2246


The printout should look like the following:


79 + 3 * (4 + 82 - 68) -7 + 19 = 145
(179 + 21 + 10) / 7 + 181 = 211
10389 * 56 * 11 + 2246 = 6401870


how do i get the whole formula in my print  ? I can only get the answer ....

[toc] | [next] | [standalone]


#2548

FromEric Sosman <esosman@comcast-dot-net.invalid>
Date2013-02-24 20:36 -0500
Message-ID<kgef4q$93p$1@dont-email.me>
In reply to#2546
On 2/24/2013 8:18 PM, Sara M. wrote:
> okay so I have this assignment and
>
> this is what they want from me :
>
>
> 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
>
>
>
> Your printout should look like the following:
> Problem 1: 1.0
> Problem 2: 39.13333333333333
> Problem 3: -1345.39999999999
> Problem 4: -1337
> Problem 5: -1313
>
>
> and I dont know how to get that !!!
>
> this is what I write in Netbeans :
>
>
>
> public class Tester {
>
>      public static void main(String []args)
>   {
>
>
>       double d1 = 37.9; //Initialize these variables at the top of your program
>       double d2 = 1004.128;
>       int i1 = 12;
>       int i2 = 18;
>
>       final double PROGRAM1=57.2 * (i1 / i2) +1;
>       final double PROGRAM2=57.2 * ( (double)i1 / i2 ) + 1;
>       final double PROGRAM3=15 – i1 * ( d1 * 3) + 4;
>       final double PROGRAM4=15 – i1 * (int)( d1 * 3) + 4;
>       final double PROGRAM5=15 – i1 * ( (int)d1 * 3) + 4;
>
> }
>
> }
>
>
> but it is wrong so can someone tell me how to get the above print they are expecting !! and I have another question  ,

     You're making progress, and it looks like your program now
calculates the values as instructed.  All that's missing is to
print the calculated results.  Do you know how to print things?
It's hard to imagine that this would not have been covered in
an early lesson, quite likely the very first lesson.  Re-read
your class notes, and see if anything comes to mind.

>
> Create a new project called ArithmeticAssignment with a class called Tester that will calculate
> and print the results of the following arithmetic problems:
>
>
> 79 + 3 * (4 + 82 –68) – 7 +19
> (179 +21 +10) / 7 + 181
> 10389 * 56 * 11 + 2246
>
>
> The printout should look like the following:
>
>
> 79 + 3 * (4 + 82 - 68) -7 + 19 = 145
> (179 + 21 + 10) / 7 + 181 = 211
> 10389 * 56 * 11 + 2246 = 6401870
>
>
> how do i get the whole formula in my print  ? I can only get the answer ....

     Since you haven't even shown how you "get" the answer, I
don't know what changes to suggest.

-- 
Eric Sosman
esosman@comcast-dot-net.invalid

[toc] | [prev] | [next] | [standalone]


#2549

From"Sara M." <kasra.song@gmail.com>
Date2013-02-24 17:44 -0800
Message-ID<afeff89b-754f-4492-88d3-ad789236536b@googlegroups.com>
In reply to#2548
On Sunday, February 24, 2013 6:36:25 PM UTC-7, Eric Sosman wrote:
> On 2/24/2013 8:18 PM, Sara M. wrote:
> 
> > okay so I have this assignment and
> 
> >
> 
> > this is what they want from me :
> 
> >
> 
> >
> 
> > 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
> 
> >
> 
> >
> 
> >
> 
> > Your printout should look like the following:
> 
> > Problem 1: 1.0
> 
> > Problem 2: 39.13333333333333
> 
> > Problem 3: -1345.39999999999
> 
> > Problem 4: -1337
> 
> > Problem 5: -1313
> 
> >
> 
> >
> 
> > and I dont know how to get that !!!
> 
> >
> 
> > this is what I write in Netbeans :
> 
> >
> 
> >
> 
> >
> 
> > public class Tester {
> 
> >
> 
> >      public static void main(String []args)
> 
> >   {
> 
> >
> 
> >
> 
> >       double d1 = 37.9; //Initialize these variables at the top of your program
> 
> >       double d2 = 1004.128;
> 
> >       int i1 = 12;
> 
> >       int i2 = 18;
> 
> >
> 
> >       final double PROGRAM1=57.2 * (i1 / i2) +1;
> 
> >       final double PROGRAM2=57.2 * ( (double)i1 / i2 ) + 1;
> 
> >       final double PROGRAM3=15 � i1 * ( d1 * 3) + 4;
> 
> >       final double PROGRAM4=15 � i1 * (int)( d1 * 3) + 4;
> 
> >       final double PROGRAM5=15 � i1 * ( (int)d1 * 3) + 4;
> 
> >
> 
> > }
> 
> >
> 
> > }
> 
> >
> 
> >
> 
> > but it is wrong so can someone tell me how to get the above print they are expecting !! and I have another question  ,
> 
> 
> 
>      You're making progress, and it looks like your program now
> 
> calculates the values as instructed.  All that's missing is to
> 
> print the calculated results.  Do you know how to print things?
> 
> It's hard to imagine that this would not have been covered in
> 
> an early lesson, quite likely the very first lesson.  Re-read
> 
> your class notes, and see if anything comes to mind.
> 
> 
> 
> >
> 
> > Create a new project called ArithmeticAssignment with a class called Tester that will calculate
> 
> > and print the results of the following arithmetic problems:
> 
> >
> 
> >
> 
> > 79 + 3 * (4 + 82 �68) � 7 +19
> 
> > (179 +21 +10) / 7 + 181
> 
> > 10389 * 56 * 11 + 2246
> 
> >
> 
> >
> 
> > The printout should look like the following:
> 
> >
> 
> >
> 
> > 79 + 3 * (4 + 82 - 68) -7 + 19 = 145
> 
> > (179 + 21 + 10) / 7 + 181 = 211
> 
> > 10389 * 56 * 11 + 2246 = 6401870
> 
> >
> 
> >
> 
> > how do i get the whole formula in my print  ? I can only get the answer ....
> 
> 
> 
>      Since you haven't even shown how you "get" the answer, I
> 
> don't know what changes to suggest.
> 
> 
> 
> -- 
> 
> Eric Sosman
> 
> esosman@comcast-dot-net.invalid




I know how to print it but it gives me a error the print is System.Out.Println(); but the last 3 lines of the code are having an issue that is what i dont get ! i dont see where the problem is 


and in the second assignment i dont get how you can print the whole formula cause in java when you type 5/2 you automatically get 2  and not the whole formula  5/2=2 .... I want to know how to print out the whole formula

[toc] | [prev] | [next] | [standalone]


#2551

Frommarkspace <markspace@nospam.nospam>
Date2013-02-24 18:06 -0800
Message-ID<kgegt8$fs1$1@dont-email.me>
In reply to#2549
On 2/24/2013 5:44 PM, Sara M. wrote:

>>> final double PROGRAM3=15 � i1 * ( d1 * 3) + 4;
>>
>>> final double PROGRAM4=15 � i1 * (int)( d1 * 3) + 4;
>>
>>> final double PROGRAM5=15 � i1 * ( (int)d1 * 3) + 4;

>
> I know how to print it but it gives me a error the print is
> System.Out.Println(); but the last 3 lines of the code are having an
> issue that is what i dont get ! i dont see where the problem is


You mean those three lines?  Better look again, I think you have some 
funny characters in there.

> and in the second assignment i dont get how you can print the whole
> formula cause in java when you type 5/2 you automatically get 2  and
> not the whole formula  5/2=2

You'll need to print the formula as a string first, then the value you 
calculated.



[toc] | [prev] | [next] | [standalone]


#2554

FromEric Sosman <esosman@comcast-dot-net.invalid>
Date2013-02-24 22:26 -0500
Message-ID<kgelin$2ft$1@dont-email.me>
In reply to#2549
On 2/24/2013 8:44 PM, Sara M. wrote:
> On Sunday, February 24, 2013 6:36:25 PM UTC-7, Eric Sosman wrote:
>> On 2/24/2013 8:18 PM, Sara M. wrote:
>> [...]
> I know how to print it but it gives me a error the print is System.Out.Println(); but the last 3 lines of the code are having an issue that is what i dont get ! i dont see where the problem is

     It's not System.Out.Println, it's System.out.println.

     (If that's not the problem, don't blame me: I can only
guess about what "a error" is, since you kept it secret.)

> and in the second assignment i dont get how you can print the whole formula cause in java when you type 5/2 you automatically get 2  and not the whole formula  5/2=2 .... I want to know how to print out the whole formula

     Try a simpler problem first: Print "Betelgeuse" and the
calculated result, so the output is

	Betelgeuse = 145
	Betelgeuse = 211
	Betelgeuse = 6401870

Now study what you've written, and think about how you might
get "(179 + 21 + 10) / 7 + 181" instead of "Betelgeuse".

-- 
Eric Sosman
esosman@comcast-dot-net.invalid

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.help


csiph-web