Question: This is for the BlueJ program. I'm suppose to fill in the missing areas and have the code compile when it's done. This is what

This is for the BlueJ program. I'm suppose to fill in the missing areas and have the code compile when it's done. This is what I have so far but it doesn't work. Please no copy and paste answers.

public class Screen

{ private int xRes; private int yRes;

public Screen(int xRes, int yRes) { this.xRes = 561; this.yRes = 894; }

public int numberOfPixels() { Screen object = new Screen (XRes*yRes); }

public void clear(boolean invert) { if(object.numberOfPixels > 2000000); { object.clear(true); } }

}

===================================================================================

Here's the original problem:

write some lines of Java code that create a Screen object. Then call its clear method if (and only if) its number of pixels is greater than two million. (Dont worry about things being logical here; the goal is only to write something that is syntactically correcti.e., that would compile if we typed it in.)

public class Screen

{

public Screen(int xRes, int yRes)

{ ...

}

public int numberOfPixels()

{ ...

}

public void clear(boolean invert)

{ ...

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!