Starting from:

$24

Dorm and Meal Plan Calculator

Make a class for dormitories that has the name of the dorm and the price per semester. You will need a constructor that will put in the values, agetPrice method to get the price of the dormitory, and atoString method for the combo box to display just the dormitory name. Make a class for the meal plans that has the description of the plan (e.g. "7 meals per week", "14 meals per week", "Unlimited meals") and the price per semester. You will need a constructor that will put in the values, agetPrice method to get the price of the meal plan, and a toStringmethod for the combo box to display just the meal plan name. Display the total charges for the semester using the DecimalFormatter and a read-only text field like I did in my demo. Do not use a message box. As you may have noticed, the toString method is very important to making the combo boxes work with objects. In a previous chapter, we used the toStringmethod to display a lot of information, but do not do that here! The toStringmethod should only display what you want to see in the combo box and nothing more.

More products