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


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

Im stuck :-s plz help again LOL

X-Received by 10.224.19.78 with SMTP id z14mr7400344qaa.4.1361755122365; Sun, 24 Feb 2013 17:18:42 -0800 (PST)
X-Received by 10.49.81.72 with SMTP id y8mr724551qex.42.1361755122336; Sun, 24 Feb 2013 17:18:42 -0800 (PST)
Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!t2no4691651qal.0!news-out.google.com!t2ni1385qaj.0!nntp.google.com!t2no4691646qal.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.java.help
Date Sun, 24 Feb 2013 17:18:41 -0800 (PST)
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=75.159.201.61; posting-account=BIrSUQoAAABdHG-VahwSv0K003rrZyTV
NNTP-Posting-Host 75.159.201.61
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <74bb5922-3b7d-4d38-8231-e4d69647ad44@googlegroups.com> (permalink)
Subject Im stuck :-s plz help again LOL
From "Sara M." <kasra.song@gmail.com>
Injection-Date Mon, 25 Feb 2013 01:18:42 +0000
Content-Type text/plain; charset=windows-1252
Content-Transfer-Encoding quoted-printable
Xref csiph.com comp.lang.java.help:2546

Show key headers only | View raw


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 ....

Back to comp.lang.java.help | Previous | NextNext in thread | Find similar | Unroll thread


Thread

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

csiph-web