It is advisement season again Many students need to decide w


It is advisement season again. Many students need to decide what classes to register for the spring semester. We are to create a program to help students decide how many classes to take to reach their goal for credits.


Our school has 1 credit, 3 credit and 4 credit courses and we assume that we have infinite supplies of those courses. In theory, if a student wants to get 15 credits, (s)he can take 15 1-credit courses. But that wouldn’t be very efficient, because the student would have to deal with 15 course locations, time slots,and etc.


Therefore our goal would be finding the shortest list of courses to take. For example, to get 15 credits with 1, 3 and 4 credit courses, the best way is to take 3 4-credit courses, 1 3-credit courses and 01-credit courses, with a total of 4 courses.


Please write a program in Java for this task.
1)Create a class Course to include such a method. (2 points)
2)Input the number of the credit the user wants, e.g. a total of 15 credits. (1 points)
3)Input the list of all possible course credits, e.g. [1, 3, 4] for the example. (1 points)
4)Use recursion to implement suggestCourse(int wantedCredit, list<Integer> courseCredits) method that returns a list of courses to take, e.g.[0, 1, 3] for the example, meaning 0 1-credit, 13-credit and 3 4-credit. (5 points)
5)Implement a non-recursive version of suggestCourse and compare it with the recursive one. (1 point)
6)Graphical interface to input values and output results. (bonus 1).

Solution

program:

Public class course

/ class name declaration /

Public static void main string [args]

/ main method declaration /

int credits = 15;

/ input and data type declaration/

 It is advisement season again. Many students need to decide what classes to register for the spring semester. We are to create a program to help students decid

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site