Page 29 - PowerPoint Presentation
P. 29
Ritcher Scale Solution
Source Code: Ritcher Scale
import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in)
double scale = sc.nextDouble();
char category;
if(scale >= 8.0) category = 'A’;
else if(scale >= 7.0) category = 'B’;
else if(scale >= 6.0) category = ‘C’;
else if(scale >= 4.5) category = 'D’;
else category = ‘E’;
System.out.println(category);
}
}