Complete the expression so that userPoints is assigned with 0 if userStreak is greater than 25 (second branch). Otherwise, userPoints is assigned with 10 (first branch).

import java.util.Scanner;

public class EqualityAndRelational {
public static void main (String args) args) {
int userBonus;
int userPoints;

userPoints = 0;

Scanner scnrnew Scanner(System.in);
userBonus = scnr.nextInt();

if (/* Your Solution goes here*/) {
userPoints = 10;
}
else {
userPoints = 0;
}

Respuesta :

Answer:

Explanation:

Modified code:

import java.util.Scanner;

public class EqualityAndRelational {

   public static void main (String args) args) {

       int userStreak;

       int userPoints;

       userPoints = 0;

       Scanner scnrnew Scanner(System.in);

       userStreak = scnr.nextInt();

       if (userStreak <= 25) {

           userPoints = 10;

       } else {

           userPoints = 0;

       }

   }

}

Following are the code to the given question:

Program Explanation:

  • Import package.
  • Defining a class EqualityAndRelational.
  • Defining the main method, inside the method two integers "userBonus, userPoints" variable is declared.
  • In the next step, a scanner class object is created that inputs value into the "userBonus" variable.
  • After input value, a conditional statement has used that checks the input value which is less than equal to 20, if it true it adds 10 in the  "userPoints" variable.
  • Otherwise, it will go to the else block in which it adds 0 into the "userPoints" variable.

Program:

Please find the attached file.

Output:

Please find the attached file.

Learn more:

brainly.com/question/12941338

Ver imagen codiepienagoya
Ver imagen codiepienagoya
ACCESS MORE
EDU ACCESS