Question
Create a package named cs520.hw2.part1 and complete the following by writing the appropriate classes under this package. 1. The course tuition is equal to the
Create a package named cs520.hw2.part1 and complete the following by writing the appropriate classes under this package.
1. The course tuition is equal to the credits for the course multiplied by the cost per credit. Create a procedural style program that meets the requirements below. Create a class named TuitionProceduralStyle and test the tuition of two different courses as specified below. Prompt the user to enter the following values for the first course one by one through a dialog box.
a. The name of the first course, the number of credits for the first course (integer type), and the cost per credit for the first course (integer type)
b. Now, prompt the user to enter the following values for the second course one by one through a dialog box. ! The name of the second course, the number of credits for the second course (integer type), and the cost per credit for the second course (integer type)
c. Compute the course tuition for the first course and store it into an appropriate variable type.
d. Display the first courses name and its tuition using a dialog box.
e. Compute the course tuition for the second course and store it into an appropriate variable type.
f. Display the second courses name and its tuition using a dialog box.
g. Using the if-else construct, check which tuition is greater than the other and display the information and the difference using a dialog box. Also, check if the tuitions are the same as part of this comparison.
h. Make sure to test your program with values for all the three scenarios possible in the above step.
(NEED HELP WITH PART 2 THE MOST)
2. Transform the procedural style computation of the previous problem into an object-oriented application. In order to do this, create two classes named Course and TuitionObjectStyle as specified below.
a. The class named Course describes each course and should have ! The instance (or member) variables courseName (String), costPerCredit (integer), and numberOfCredits (integer). ! The appropriate set methods for the above three variables. ! The appropriate get methods for the above three variables. ! The method getTotalTuition which returns the tuition for this course. ! The method printTuitionDetails which displays the name and the tuition of this course using a dialog box.
b. The class named TuitionObjectStyle creates two course objects and tests them as follows: ! In the main method, instantiate two objects of the type Course named course1 and course2. Perform the equivalent steps to the ones carried out in Step 1.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started