"Program 15"
Title: Use the nesting of conditional operators to complete this problem: the students of the study score >=90 with a, 60-89 points between the use of B, 60 points below the C expression.
1. Program Analysis: (a>b)? A:b This is a basic example of a conditional operator.
2. Program Source code:
1 ImportJava.util.Scanner;2 3 /*this article transferred from blog: www.cnblogs.com/java-1004 "Program 15"5 title: Use the nesting of conditional operators to complete this problem: the students of the study score >=90 with a, 60-89 points between the use of B, 60 points below the C expression. 6 Program Analysis: (a>b)? A:b This is a basic example of conditional operators. 7 */8 9 Public classJAVA15 {Ten One Public Static voidMain (string[] args) { ASystem.out.print ("Please enter score:"); -Scanner Scanner =NewScanner (system.in); - intScore =scanner.nextint (); the scanner.close (); - CharLevel = (score >= 60)? (Score >= 90?) ' A ': ' B '): ' C '; -System.out.print ("Your rating is" +Level ); - } +}
Java rewrite "C Classic 100 Questions"--15