package homework; import javax.swing.JOptionPane; public class homework2 { public static void main(String[] args) { String name,major,data; double meal,tuition,fee,total ,discount,findue; int credits; name=getName(); major=JOptionPane.showInputDialog(null,"Enter Major","Input Data",JOptionPane.QUESTION_MESSAGE); data=JOptionPane.showInputDialog(null," Number of credits","Input Data",JOptionPane.QUESTION_MESSAGE); credits=Integer.parseInt(data); data=JOptionPane.showInputDialog(null," Amount of meal plan","Input Data",JOptionPane.QUESTION_MESSAGE); meal=Double.parseDouble(data); tuition=credits*800; fee=credits*25; total=getTotal(tuition, fee, meal); discount=total*.05; findue=total-discount; printDetails(name, major, credits); System.out.println("Tuition = "+tuition); System.out.println("Technology Fee ="+fee); System.out.println("Meal Plan ="+meal); System.out.println("Total Due ="+total); System.out.println("Discount ="+discount+"\n"); System.out.println("Final Amount Due ="+findue); System.exit(0); } public static String getName() { String name; name=JOptionPane.showInputDialog(null,"Enter Name","Input Data",JOptionPane.QUESTION_MESSAGE); return name; } public static double getTotal(double tuition, double fee, double meal) { double total; total= tuition+fee+meal; return total; } public static void printDetails(String name,String major, int credits) { System.out.println("RMU"); System.out.println("Student Bill for : "+name+"\n"); System.out.println("Major= "+major); System.out.println("Number of Credits= "+credits); } }