<p>Write a program that will compute and print the semester tuition bill for the
ID: 3635492 • Letter: #
Question
<p>Write a program that will compute and print the semester tuition bill for the University of Computers. The program will keep a running total for all students and print this as well as well as the result for the University of Computers. Keep input and output methods cohesive and complete. That is, input and output methods only methods do one thing (cohesive) and do all of it (complete.) Create a University class that will have data and methods associated with the University. A demo class to demonstrate these classes in given. there should be three classes.<br /><br />Example input would be:<br /><br />First Name // Fred<br />Last Name // Jones<br />Address // 1934 Same Street<br />Phone Number // 703 555 5343<br />Credits enroll // 19<br />Qualifies for instate rate // yes<br />Late fee assessed // yes<br />On campus food // yes<br />Health care option // yes<br /><br />The calculations are as follows:<br />Tuition rates Instate rate Out of state rate<br />Less than 12 credits $102.50 $351.00<br />12 - 18 credits $75.45 $255.00<br />Over 18 credits $93.00 $304.00<br />Late fee is 10% of tuition bill figured on credit cost only.<br />Incidental fees are $20 / credit up to a maximum of $250.00.<br />Optional health care: $25.00 first 10 credits<br />$20.00 next 5 credits<br />$15.00 over 15 credits<br />If on campus food is the case then further input from the user is necessary:<br />Meal plan stuff-your-face is $4,999.00<br />Meal plan I-can'-stand-this-food is $3,499.00<br />Meal plan I'm-on-a-diet is $2,599.00<br />Example output for a single student using the above data is: (this is compute accurately)<br />NAME Jim Jackson CREDITS 19<br />ADDRESS 1934 Same Street<br />PHONE 703 555 5343<br />TUITION $1748.65<br />LATE FEE $174.86<br />INCIDENTAL $250.00<br />HEALTHCARE $410.00<br />MEAL PLAN $3,499.00<br />TOTAL $6082.51<br />Example out put for the school would be:<br />UNIVERSITY OF COMPUTERS<br />NUMBER OF STUDENTS 390<br />INSTATE 200<br />OUT OF STATE 190<br />MEAL PLAN STUFF-YOUR-FACE 30 $149,970.00<br />I-CAN'T-STAND-THIS-FOOD 145 $507,355.00<br />I'M-ON-A-DIET 154 $400,246.00<br />FOOD SUB TOTAL $1,057,246.00<br />TUITION $57,767.20<br />LATE FEE $3,553.50<br />INCIDENTAL $4,450.00<br />HEALTHCARE $90,000.00<br />TOTAL $1,213,341.70<br /><br />import java.io*;<br />public class StudentDemo<br />{<br />public static void main(String[] args)<br />{<br />Reporter clerk = new Reporter();<br />Student person = new Student();// one student<br />int numberOfStudents, i, count;<br />System.out.println("Enter number of students:");<br />numberOfStudents = scan.nextInt();<br />for(i=0; i < numberOfStudents; i++)<br />{<br />person.readInput();<br />person.calculateData();<br />person.writeOutput();<br />clerk.collectDataForReport(person);<br />}<br />clerk.printDataForSchoolReport();<br />}<br />}<br /><br />public class OutPut // class that can be used to print one line of output</p><p>{</p>
<p>public static void printStringLeft (int size, String formatted)</p>
<p>// Blank fills and left justifies a string in a field aof size characters</p>
<p>{</p>
<p>int lenght = formated.length();</p>
<p>System.out.println(formatted);</p>
<p>while (size > length)</p>
<p>{</p>
<p>System.out.print(" ");</p>
<p>size --;</p>
<p>} // End while (size > length)</p>
<p>} // End function printString</p>
<p>public static void printStringRight (int size, String formatted)</p>
<p>// Blank fills and right justifies a string in a field of size charaters</p>
<p>{</p>
<p>int length = formatted.length();</p>
<p>while (size > lenghts)</p>
<p>{</p>
<p>System.out.print(" ");</p>
<p>size --;</p>
<p>} // End while (size > length)</p>
<p>System.out.println(formatted);</p>
<p>} // End function printString</p>
<p> </p>
<p>// two ways to do money fromating</p>
<p>import java.text.DemcimalFormat;</p>
<p>import java.text.NumberFormat;</p>
<p>public class MoneyFormatDemo</p>
<p>{</p>
<p>public static void main(String[] args)</p>
<p>{</p>
<p>NumberFormat moneyFormatter = NumberFormat.getCurrencyInstance();</p>
<p>System.out.println(moneyFormatter.format(2003.4));</p>
<p>System.out.println(money);</p>
<p>DecimalFormat dollarFormat = new DecimalFormant ("$ #,###,###.00");</p>
<p>money = dollarFormat.format(20043.44);</p>
<p>System.out.,println(money);</p>
<p>}</p>
<p>}</p>
Explanation / Answer
import java.util.*;
public class Student {
private String FirstName;
private String LastName;
private String Address;
private String PhoneNumber;
private int Credits;
private double Tuition;
double Health_Care;
double Late_Fee;
double Meal_Plan;
double TotalTuition;
double IncidentalFee;
private boolean state;
private boolean LateFee;
private boolean CampusFood;
private boolean HealthCare;
public Student()
{
}
public Student(String studentFirstName, String studentLastName, String studentAddress,String studentPhoneNumber, int studentCredits, double studentTuition, double studentHealth_Care, double studentLate_Fee, double studentMeal_Plan, double studentTotalTuition, double studentIncidentalFee, boolean studentstate, boolean studentLateFee, boolean studentCampusFood, boolean studentHealthCare)
{
FirstName = studentFirstName;
LastName = studentLastName;
Address = studentAddress;
PhoneNumber = studentPhoneNumber;
Credits = studentCredits;
Tuition = studentTuition;
Health_Care = studentHealth_Care;
Late_Fee = studentLate_Fee;
Meal_Plan = studentMeal_Plan;
TotalTuition = studentTotalTuition;
IncidentalFee = studentIncidentalFee;
state = studentstate;
LateFee = studentLateFee;
CampusFood = studentCampusFood;
CampusFood = studentHealthCare;
}
// Set Methods
void FirstName (String studentFirstName)
{
FirstName = studentFirstName;
}
void LastName (String studentLastName)
{
LastName = studentLastName;
}
void Address (String studentAddress)
{
Address = studentAddress;
}
void PhoneNumber (String studentPhoneNumber)
{
PhoneNumber = studentPhoneNumber;
}
void Credits (int studentCredits)
{
Credits = studentCredits;
}
void Tuition (double studentTuition)
{
Tuition = studentTuition;
}
void Health_Care (double studentHealth_Care)
{
Health_Care = studentHealth_Care;
}
void Late_Fee (double studentLate_Fee)
{
Late_Fee = studentLate_Fee;
}
void Meal_Plan (double studentMeal_Plan)
{
Meal_Plan = studentMeal_Plan;
}
void TotalTuition (double studentTotalTuition)
{
TotalTuition = studentTotalTuition;
}
void IncidentalFee (double studentIncidentalFee)
{
IncidentalFee = studentIncidentalFee;
}
void state (Boolean studentstate)
{
state = studentstate;
}
void LateFee (Boolean studentLateFee)
{
LateFee = studentLateFee;
}
void CampusFood (Boolean studentCampusFood)
{
CampusFood = studentCampusFood;
}
void HealthCare (Boolean studentHealthCare)
{
HealthCare = studentHealthCare;
}
// Get Method
String FirstName()
{
return FirstName;
}
String LastName()
{
return LastName;
}
String Address()
{
return Address;
}
String PhoneNumber()
{
return PhoneNumber;
}
int Credits()
{
return Credits;
}
double Tuition()
{
return Tuition;
}
double Health_Care()
{
return Health_Care;
}
double Late_Fee()
{
return Late_Fee;
}
double Meal_Plan()
{
return Meal_Plan;
}
double TotalTuition()
{
return TotalTuition;
}
double IncidentalFee()
{
return IncidentalFee;
}
boolean state()
{
return state;
}
boolean LateFee()
{
return LateFee;
}
boolean CampusFood()
{
return CampusFood;
}
boolean HealthCare()
{
return HealthCare;
}
public void readInput()
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter first name");
FirstName=sc.next();
System.out.println("Enter last name");
LastName=sc.next();
System.out.println("Enter address");
Address=sc.next();
System.out.println("Enter phone number");
PhoneNumber=sc.next();
System.out.println("Enter the credits you are taken");
Credits=sc.nextInt();
System.out.println("Do you Qualify for the instate rate? Enter True for yes or False for no");
state = sc.nextBoolean();
System.out.println("Late fee assessed? Enter True for yes or False for no");
LateFee=sc.nextBoolean();
System.out.println("Do you want a meal plan? Enter True for yes or False for no");
CampusFood=sc.nextBoolean();
System.out.println("Do you want Health Care? Enter True for yes or False for no");
HealthCare=sc.nextBoolean();
}
public void calculateData()
{
if (state == true)
{
if (Credits < 12)
Tuition = (Credits*102.50);
}
{
if(Credits>11 || Credits<19);
Tuition = (Credits* 75.45);
}
{
if (Credits>18)
Tuition = (Credits*93.00);
}
if (state == false)
{
if (Credits < 12)
Tuition = (Credits*351.00);
}
{
if(Credits>11 || Credits<19);
Tuition = (Credits* 255.00);
}
{
if (Credits>18)
Tuition = (Credits*304.00);
}
if (LateFee == true)
{
Late_Fee = Tuition/10;
}
if (CampusFood == true)
{
Meal_Plan = 3499.00;
}
if(HealthCare == true)
{
if (Credits < 11)
Health_Care = 25.00;
}
{
if(Credits>10 || Credits<16);
Health_Care = 20.00;
}
{
if (Credits>15)
Health_Care = 15.00;
}
{
IncidentalFee = Credits * 20;
}
{
TotalTuition = Tuition + Late_Fee + IncidentalFee + Health_Care + Meal_Plan;
}
}
public void writeOutput()
{
System.out.println("Name: " + FirstName + " " + LastName);
System.out.println("Address: " + Address);
System.out.println("PhoneNumber: " + PhoneNumber);
System.out.println("Credits: " + Credits);
System.out.println("Tuition: " + Tuition);
System.out.println("Late Fee: " + Late_Fee);
System.out.println("Incedental: " + IncidentalFee);
System.out.println("Health Care: " + Health_Care);
System.out.println("Meal Plane: " + Meal_Plan);
System.out.println("Total: " + TotalTuition);
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.