Answer to Question #312365 in Java | JSP | JSF for Sai

Question #312365

Write an if-else statement that if userTickets is greater than 5, executes award Points = 15 Else, execute award Points = user Tickets. Ex: If user Tickets is 14, then award Points = 15.

1
Expert's answer
2022-03-16T07:08:12-0400


import java.util.Scanner;


public class App {


	/** Main Method */
	public static void main(String[] args) {
		Scanner keyBoard = new Scanner(System.in); // Create a Scanner
		System.out.print("Enter user tickets: ");
		int userTickets = keyBoard.nextInt();
		if (userTickets > 5) {
			System.out.println("Award Points = 15");
		} else {
			System.out.println("Award Points = " + userTickets);
		}


		keyBoard.close();
	}


}

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