IF ELSE CONDITIONAL STATEMENT
Write a JAVA program that will input the following data: Student Name, Average, Tuition Fee
and output Total Tuition Fee.
Formula: Total Tuition Fee = Tuition Fee – Discount
If average is: 95 – 100 100% discount
90 – 94 25%
85 – 89 10%
84 and below no discount
package tuition;
import java.util.Scanner;
public class Tuition {
public static void main(String[] args) {
System.out.println("Enter the Student Name: \n");
Scanner scan = new Scanner(System.in);
String StudentName = scan.nextLine();
System.out.println("Enter the Average: \n");
double Average = scan.nextDouble();
System.out.println("Enter the Tuition Fee: \n");
double TuitionFee = scan.nextDouble();
double total=0;
if(Average>= 95 && Average<=100){
total = TuitionFee - (TuitionFee * 1);
}
else if(Average>= 90 && Average<=94){
total = TuitionFee - (TuitionFee * 0.25);
}
else if(Average>= 85 && Average<=89){
total = TuitionFee - (TuitionFee * 0.1);
}
else if(Average<84){
total = TuitionFee;
}
System.out.println("Total Tuition Fee is: \n"+total);
}
}
Comments
Leave a comment