this goes into a comment block after your header in your code file. 1) Convert t
ID: 671553 • Letter: T
Question
this goes into a comment block after your header in your code file.
1) Convert the English expression “If the value is between 0 and 100 inclusively” to a Java expression
2) Convert the English expression “If the answer is neither “No” or “no” “ to a Java expression
3) Write an if statement to check if val1 and val2 are greater than val3
4) I have a moving box that is represented by four variables: xLoc, yLoc, width and height. xLoc and yLoc describe the location of the upper left corner of the box. The boundaries of the screen are represented by the constants LEFT_EDGE, RIGHT_EDGE, TOP_EDGE and BOTTOM_EDGE. Write an if-statement or nested-if-statment to ensure the moving box is within the boundaries.
Explanation / Answer
1)
if (val >=0 && val <=100)
2)
if (answer == "No" || answer == "no")
3)
if((val1 > val 3 ) && (val2 > val3))
4)
if ((xLoc>= LEFT_EDGE && xLoc<=RIGHT_EDGE) && ((xLoc+width)>= LEFT_EDGE && (xLoc+width)<=RIGHT_EDGE))
{
Inside boundary
}
else if ((yLoc>= TOP_EDGE && yLoc<=BOTTOM_EDGE) && ((yLoc + height)>= TOP_EDGE && (yLoc + height)<=BOTTOM_EDGE))
{
inside bounday
}
else
{
out of boundary
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.