Java Code

Associate
Joined
15 Nov 2004
Posts
92
Location
The land of Eng
I can't seem to get this code to work:

Code:
public void areaRectangle()
  {

      double area;
      double itsHeight;
      double itsWidth;
      
      System.out.println("Okay, so you want to calculate a Rectangle");   

      itsHeight = readString("Enter the height of the rectangle");
      itsWidth = readString("Enter the width of the rectangle");
                           
      area = itsWidth * itsHeight;
      
      System.out.println("The area of the rectangle is:" + area);    


  }

It keeps saying:

incompatible types; found : java.lang.string, required; double at line 55, column 19 (The line were " itsHeight = readString("Enter the height of the rectangle");" is)
 
I figured it out in the end. Thanks to everyone that responded. You rock. :cool:

It's a little silly what I've had to do -- My tutor for the programming side of my degree decided that he'd make us create a program in Java using some VB code as an example and put this as half of the marks for the final assignment. Yet we've done 99.5% VB coding this year and only an hour on Java coding. What an idiot.

I've had to basically teach myself how to code as my teacher is about as helpful as smacking your face with a plank of wood repeatedly. :(
 
Back
Top Bottom