Answer to Question #260652 in Java | JSP | JSF for erick

Question #260652

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 


1
Expert's answer
2021-11-03T11:44:09-0400


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);
 
    }
    
}

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