Answer to Question #235116 in Java | JSP | JSF for grissy

Question #235116

Write an if-else statement for the following:

If userTickets is not equal to 6, execute awardPoints = 10. Else, execute awardPoints = userTickets.


Ex: If userTickets is 14, then awardPoints = 10.


1
Expert's answer
2021-09-09T04:09:39-0400


package tickets;


import java.util.Scanner;
public class Tickets {


    
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        System.out.println("Enter user tickets");
        int userTickets = scan.nextInt();
        int awardPoints;
        if(userTickets != 6){
            awardPoints = 10;
        }
        else{
            awardPoints = userTickets; 
        }
        System.out.println("The award points is:    "+ awardPoints);
    }
    
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS