public class Student{    private int studentNum;    private int studentScore;    public int MAX_NUM = 500;    public int MAX_SCORE = 100;    Student(int num, int score)    {    }Decision making can be used to control the allowed values in an object's fields. In the above code, the Student class contains two fields that hold a student number and a score. A constructor accepts values for these fields as parameters. Write the code between the curly brackets that will determine whether the value of num is less than the MAX_NUM constant. If true, assign the value of num to studentNum. Otherwise, assign the value of MAX_NUM to the studentNum. Then check if the value of score is less than or equal to MAX_SCORE. If true, assign the value of score to studentScore.

Otherwise, assign 0 to studentScore.

What will be an ideal response?


if(num <= MAX_NUM)
   studentNum = num;
else
   studentNum = MAX_NUM;
if(score <= MAX_SCORE)
    studentScore = score;
else
    studentScore = 0;

Computer Science & Information Technology

You might also like to view...

This is a dummy function that is called instead of the actual function it represents:

a. main b. stub c. a driver d. an overloaded function

Computer Science & Information Technology

Answer the following statements true (T) or false (F)

1. Check boxes may be grouped in a ButtonGroup, like radio buttons are. 2. All operating systems offer the same set of GUI components. 3. The System.exit method will end the application. 4.The ActionEvent argument that is passed to an action listener's actionPerformed method is the event object that was generated in response to an event.

Computer Science & Information Technology

A reflector is a person on an e-list that is responsible for enforcing behavior rules of the e-list

Indicate whether the statement is true or false

Computer Science & Information Technology

To add shading or patterns to a paragraph, select the text you want to shade. In the Paragraph group on the Insert tab, click the arrow beside the Shading button, and then click a color in the palette that opens.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology