Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Multiplying Variables in java

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 03-12-2009
Member
 
Join Date: Nov 2009
Posts: 330
Multiplying Variables in java
  

Hi friends
I program in java and so I use the best IDE for it, that it I use Eclipse IDE but the problem is that I am having a error on my varaible declaration line after I type every third line. Please check, I have posted it below
Code:
import java.math.*;
.
.
.
.
.
double cnt, energycnt, transRange;
energycnt = cnt * Math.pow(transRange,2);
Any idea on this. Please.

Reply With Quote
  #2  
Old 03-12-2009
Member
 
Join Date: Jan 2008
Posts: 1,515
Re: Multiplying Variables in java

Hi
Please check the following code, this may help you.
Code:
public class sennode {
private int xcord;
private int ycord;
private double energyLevel;
public sennode(int xInit, int yInit, double newEnergy){
xcord = xInit;
ycord = yInit;
energyLevel = newEnergy;
}

double const = 0 ;
double energycnt = 0;
double transRange = 0;

energycnt = const * Math.pow(transRange,2);
}
Reply With Quote
  #3  
Old 03-12-2009
Member
 
Join Date: Nov 2009
Posts: 330
Re: Multiplying Variables in java

Hi
Thanks for your help and your code.
I have read your code in details but unfortunately that is not the problem for sure. May be you can try something different. Thanks again.
Reply With Quote
  #4  
Old 03-12-2009
Member
 
Join Date: May 2008
Posts: 2,382
Re: Multiplying Variables in java

Hi
May be this code can help you
Code:
public class sensorNode {

	private int xcord;
	private	int ycord;
	private	double energyLevel;	
	
	/**
	 * @param xInit the x-coordinate for node
	 * @param yInit the y-coordinate for node
	 * @param newEnergy the initial energy for node
	 */
	public  sensorNode(int xInit, int yInit, double newEnergy){
		
		xcord = xInit;
		ycord = yInit;
		energyLevel = newEnergy;
	}

	double const = 0 ;
	double energycnt = 0;
	double transRange = 0;

	energycnt = const * Math.pow(transRange,2);
	
}
__________________
The FIFA Manager 2009 PC Game
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Multiplying Variables in java"
Thread Thread Starter Forum Replies Last Post
What are an Atomic Variables in Java? Dilbert Software Development 5 04-01-2011 06:51 PM
About instance variables in java Khaled11 Software Development 1 19-03-2010 02:38 PM
Java properties / variables dynamically Miles Runner Software Development 5 04-03-2010 10:31 AM
What is Instance variables in Java? Owen Fernandes Software Development 5 23-01-2010 07:27 AM
Java bans Global Variables KALLIYAN Software Development 4 10-11-2009 03:17 AM


All times are GMT +5.5. The time now is 03:56 PM.