import java.util.Scanner;
public class GradeCalculatorIF
{
public static void main (String [] args)
{
Scanner sc = new Scanner(System.in);
System.out.println("Please input a student unit total");
double unitTotal = sc.nextDouble();
if(unitTotal >= 0 && unitTotal < 50)
{
System.out.println("F-<m");
}
if(unitTotal >= 50 && unitTotal < 60)
{
System.out.println("P-5");
}
if(unitTotal >= 60 && unitTotal < 70)
{
System.out.println("C-6");
}
if(unitTotal >= 70 && unitTotal < 80)
{
System.out.println("D-7");
}
if(unitTotal >= 80 && unitTotal < 90)
{
System.out.println("HD-8");
}
if(unitTotal >= 90 && unitTotal < 100)
{
System.out.println("HD-9");
}
if(unitTotal == 100)
{
System.out.println("HD-10");
}
if(unitTotal > 100 && unitTotal < 0)
{
System.out.println("Invalid");
}
}
}
How can I change that into a switch statement? Please help a brother out here.
public class GradeCalculatorIF
{
public static void main (String [] args)
{
Scanner sc = new Scanner(System.in);
System.out.println("Please input a student unit total");
double unitTotal = sc.nextDouble();
if(unitTotal >= 0 && unitTotal < 50)
{
System.out.println("F-<m");
}
if(unitTotal >= 50 && unitTotal < 60)
{
System.out.println("P-5");
}
if(unitTotal >= 60 && unitTotal < 70)
{
System.out.println("C-6");
}
if(unitTotal >= 70 && unitTotal < 80)
{
System.out.println("D-7");
}
if(unitTotal >= 80 && unitTotal < 90)
{
System.out.println("HD-8");
}
if(unitTotal >= 90 && unitTotal < 100)
{
System.out.println("HD-9");
}
if(unitTotal == 100)
{
System.out.println("HD-10");
}
if(unitTotal > 100 && unitTotal < 0)
{
System.out.println("Invalid");
}
}
}
How can I change that into a switch statement? Please help a brother out here.


