Question: Write a program that will compute and print the semester tuition bill for University of Computers. The program will keep a running total for all

Write a program that will compute and print the semester tuition bill for University of Computers. The program will keep a running total for all students and print this as well as a result for the University of the Comouters. Create a University class that will have data and methods associated with the University. You must use Demo program that is given below. Please note: method calculateData(); must call private methods to do the calculations. An instance of the student is sent into the method collectDataForReport(person);(). The data of the student is private and you will need a getTuition() method to access it. A sample line of code in the University class would be : totalTuition = totalTuition+person.getTuition();

YOU MUST USE THIS DEMO:

import java.util.Scanner;

public class UniversityDemo {

static Scanner scan = new Scanner(System.in);

public static void main(String[] args) {

University clerk = new University( );

Student student = new Student();// one student

int i;

System.out.println("Enter number of students:");

int numberOfStudents = scan.nextInt();

for (i = 1; i <= numberOfStudents; i++) {

System.out.println("Enter data for student number " + i);

student.readInput();

student.calculateData();

student.writeOutput( );

clerk.colectDataForUniversityReport(student);

}

clerk.printDataForSchoolReport();

} }

/* the calculateData() method must have private methods. Examples: tuitionCalculation() lateCalculation (); healthCareCalculation(); incidentalCalculation (); readMealSelection(); computeFoodFee(); Getters and Setters for the private data is necessary. Eclipse will create them for you. Place your mouse where you would like them (Usually at the bottom of the class). Right click, choose Source, choose Generate Getters and Setters. Choose the private variables you want. (all of them). */

two ways to do money formating : money formatting should be included

public class OutPut { // ************************************************************************* //Blank fills and left justifies a string in a field of size characters // and returns string public static String makeStringLeft(int size, String formatted) { String answer = ""; int length = formatted.length(); answer = answer + formatted; while (size > length) { answer = answer + " "; size --; } // End while (size > length) return answer; } public static void printStringLeft(int size, String formatted) // Blank fills and left justifies a string in a field of size characters { int length = formatted.length(); System.out.print(formatted); while (size > length) { System.out.print(" "); size --; } // End while (size > length) } // End function printString // ************************************************************************* //Blank fills and right justifies a string in a field of size characters // and returns string public static String makeStringRight(int size, String formatted) // Blank fills and right justifies a string in a field of size characters { String answer = ""; int length = formatted.length(); while (size > length) { answer = answer + " "; size --; } // End while (size > length) answer = answer + formatted; return answer; } public static void printStringRight(int size, String formatted) // Blank fills and right justifies a string in a field of size characters { int length = formatted.length(); while (size > length) { System.out.print(" "); size --; } // End while (size > length) System.out.print(formatted); } // End function printString // *************************************************************************** }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!