Hi, I've just programmed a class that should be able to tell me how big I should buy a projector screen for my church, when I try to compile the class though, which will be used in the main method of another application, I get two small errors that I can't figure out.
Errors:- '{' expected at line 7
- '}' expected at line 68
Here's the code for your review:
Code:
/*John Jelinek IV
*May 22, 2005
*projectorSize.java
*/
/* will determine how big the projector screen should be */
class projectorSize() // LINE 7
{
// NOTE: Rear Projector Screen Means Projector That Projects From Behind The Screen
private double rearRows; // distance of rear projector screen to last row of seats
private double nearRows; // distance of front projector screen to nearest row of seats
private double farRows; // distance of front projector screen to farthest row of seats
/* overloaded constructor that grabs nearRows, farRows, and rearRows in that order */
public projectorSize(double frontNear, double frontFar, double rearNear)
{
nearRows = frontNear; // sets nearRows to the value the user has indicated
farRows = frontFar; // sets farRows to the value the user has indicated
rearRows = rearNear; // sets rearRows to the value the user has indicated
}
/* returns default projector screen width from current distance */
public double getDefWidth()
{
return nearRows / 2; // default width of front projector
}
/* returns alternative projector screen width from current distance */
public double getAltWidth()
{
return farRows / 6; // alternate width of front projector
}
/* returns rear projector screen width from current distance */
public double getRearWidth()
{
return rearRows / 8; // default width of rear projector
}
/* will determine the height for a 4:3 aspect ratio */
public double getHeight()
{ return ((getDefWidth() * 3) / 4); }
/* will determine the height for a 4:3 aspect ratio */
public double getAltHeight()
{ return ((getAltWidth() * 3) / 4); }
/* will determine the height for a 4:3 aspect ratio */
public double getRearHeight()
{ return ((getRearWidth() * 3) / 4); }
/* will determine the height for a 16:9 aspect ratio */
public double getWideHeight()
{ return ((getDefWidth() * 9) / 16); }
/* will determine the height for a 16:9 aspect ratio */
public double getWideAltHeight()
{ return ((getAltWidth() * 9) / 16); }
/* will determine the height for a 16:9 aspect ratio */
public double getWideRearHeight()
{ return ((getRearWidth() * 9) / 16); }
/* to be messed with after it compiles
//overridden toString()
public String toString(){
return "Distance of rear projector screen from last row: " + Integer.toString(rearRows);
}//end overridden toString()
*/
} // LINE 68
Bookmarks