Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program that displays a student tuition report. A loop in the program sh

ID: 3814505 • Letter: W

Question

Write a program that displays a student tuition report. A loop in the program should ask the user for a fictitious student ID number, total financial aid received by the student, amount paid for tuition, amount paid for fees, amount paid for books, amount paid for housing, and amount paid for the meal plan. The loop will terminate when 0 is entered for the student ID number. After the data for all students is entered and the loop terminates, the program should display overall totals for financial aid, tuition, fees, books, housing, meal plan and remaining cost, added together for all students.

Hint: Remaining cost is financial aid subtracted from the sum of all other values.

Explanation / Answer

TuitionReport.java

import java.util.Scanner;

public class TuitionReport {

   public static void main(String[] args) {
       //Declaring variables
       int SENTINEL=0;
       int studId = 0;
       double financialAid=0,totFinbalcuialAid=0;
       double tuitionFee=0,totTuitionFee=0;
       double fee=0,totFee=0;
       double booksFee=0,totBooksFee=0;
       double housingFee=0,totHousingFee=0;
       double mealsFee=0,totMealsFee=0;
       double remCost=0;
      
       //Scanner object is used to get the inputs entered by the user
               Scanner sc=new Scanner(System.in);

               //getting the inputs entered by the user
               System.out.print("Enter the Student ID :");
               studId=sc.nextInt();
              
              
               if (studId!=SENTINEL) {
                   //This loop continues to execute until the user enters Zero as Student ID
                   while(studId!=SENTINEL)
                   {
                       //Getting the inputs entered by the user
                       System.out.print("Enter Total Financial Aid :$");
                       financialAid=sc.nextDouble();
                      
                       //calculating the Total Financial Aid
                       totFinbalcuialAid+=financialAid;
                      
                       System.out.print("Enter Amount Paid for Tuition :$");
                       tuitionFee=sc.nextDouble();
                      
                       //calculating the Total Tuition Aid
           totTuitionFee+=tuitionFee;
          
                       System.out.print("Enter Amount Paid for Fee :$");
                       fee=sc.nextDouble();
                      
                       //calculating the Total Fee
                       totFee+=fee;
                      
                       System.out.print("Enter Amount Paid for Books :$");
                       booksFee=sc.nextDouble();
                      
                       //calculating the Total Books fee
                       totBooksFee+=booksFee;
                      
                       System.out.print("Enter Amount Paid for Housing :$");
                       housingFee=sc.nextDouble();
                       //calculating the Total Housing fee
                       totHousingFee+=housingFee;
                      
                       System.out.print("Enter Amount Paid for Meal Plan :$");
                       mealsFee=sc.nextDouble();
                       //calculating the Total Meals fee
                       totMealsFee+=mealsFee;
                      
                       //calculating the Total remaining cost
                       remCost+=(financialAid-(tuitionFee+fee+booksFee+housingFee+mealsFee));
                      
                       System.out.print(" Enter the Student ID :");
                       studId=sc.nextInt();
                   }
                  
                   //displaying the output
                   System.out.println(" Total Financial AID :$"+totFinbalcuialAid);
                   System.out.println("Total Tution Fee :$"+totTuitionFee);
                   System.out.println("Total Fee :$"+totFee);
                   System.out.println("Total Books Fee :$"+totBooksFee);
                   System.out.println("Total Housing Fee :$"+totHousingFee);
                   System.out.println("Total Meals Fee :$"+totMealsFee);
                   System.out.println("Total Remaining Amount :$"+remCost);
                  
               }
               else
               {
                   System.out.println(":: No Data ::");
               }
   }

}

_____________________

Output:

Enter the Student ID :111
Enter Total Financial Aid :$55000
Enter Amount Paid for Tuition :$35000
Enter Amount Paid for Fee :$5000
Enter Amount Paid for Books :$2000
Enter Amount Paid for Housing :$1000
Enter Amount Paid for Meal Plan :$1000

Enter the Student ID :222
Enter Total Financial Aid :$60000
Enter Amount Paid for Tuition :$40000
Enter Amount Paid for Fee :$3000
Enter Amount Paid for Books :$2000
Enter Amount Paid for Housing :$1200
Enter Amount Paid for Meal Plan :$1000

Enter the Student ID :333
Enter Total Financial Aid :$70000
Enter Amount Paid for Tuition :$45000
Enter Amount Paid for Fee :$5000
Enter Amount Paid for Books :$3000
Enter Amount Paid for Housing :$2000
Enter Amount Paid for Meal Plan :$1200

Enter the Student ID :444
Enter Total Financial Aid :$55000
Enter Amount Paid for Tuition :$35000
Enter Amount Paid for Fee :$3500
Enter Amount Paid for Books :$3000
Enter Amount Paid for Housing :$2000
Enter Amount Paid for Meal Plan :$1500

Enter the Student ID :0


Total Financial AID :$240000.0
Total Tution Fee :$155000.0
Total Fee :$16500.0
Total Books Fee :$10000.0
Total Housing Fee :$6200.0
Total Meals Fee :$4700.0
Total Remaining Amount :$47600.0

___________Thank You

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote