Sara M.
2013-02-21 18:30:08 UTC
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;
}
}
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;
}
}