Write a Java program that displays at least four (4) lines of your favorite song. Name the class as FavoriteSong.java and add meaningful comments to the class.
You will create Cart class as a context class to get total price and add product.
◦ To implement Strategy pattern, depending on the country of shipping, the relevant customs duty is charged and the shipping cost of Europe Shopping, America Shopping increases. Large products (XL-size) have an additional charge. Create AmericaShopping and EuropeShopping concrete class.
◦In the USA, the duty tax is 1% and the base delivery fee is $15. In America, an additional tax different from the customs tax is applied and this tax is 0.75%. Customs duty should be added to the item fee for each item.
◦In Europe, the customs duty is 1.5% and the base delivery fee is £11.
◦In America, $5 should be added to the shipping fee when each item is added. But if the added product size is XL, $10 should be added to the shipping fee. In Europe, this should only be done if the product size is XL.
StudentLoans class
6 Code a method displayLoanAmounts(). This method display all the loan amounts and the interest on those amounts. Output format example:
Loan amounts and Interest
--------------------------
10000.0 500.0
-------------------------
50000.0 2500.0
-------------------------
20000.0 2000.0
-------------------------
StudentLoans class
5 Code a method displayAllStudents(). This method has no parameters and is void. This method displays all the objects in the array.
a) Display a heading .
b) Loop through the array and use the show() of every object to display the object details. c) Print a line after each object is displayed. Example of expected output:
Displaying all students
--------------------
Student details
Name: Smittie
Student number: 12345
Loan amount: 10000.0
-------------------------
Student details Name: Jannie
Student number: 67543
Loan amount: 50000.0
-------------------------
StudentLoans class
3 Code a method named createStudent(). This method has no parameters, but returns a Student object.
a) Define a Scanner variable to read from the keyboard.
b) Define variables for name, student number and loan amount. Prompt the user to type data values for each of the variables and then read the values from the keyboard.
c) Define and create a Student object from the data read from the keyboard.
d) Return this Student object.
4 Code a method named createPostGraduate(). This method has no parameters, but returns a PostGraduate object.
a. Define a Scanner variable to read from the keyboard.
b. Define variables for name, student number and loan amount and thesis. Prompt the user to type data values for each of the variables and then read the values from the keyboard.
c. Define and create a PostGraduate object from the data read from the keyboard.
d. Return this PostGraduate object.
StudentLoans class
1 Code a no-argument constructor. In this constructor, a) Add 2 Student objects to the Students array. b) Add 2 PostGraduate objects to the Students array. c) Set noOfStudents to 4.
2 Code a method menu() that returns an int value. This value represents the choice the user has made from the available menu options. a) Define a Scanner variable to read from the keyboard. b) Define an int value, named choice. c) Display a menu in the following format:
1: Add student
2: Display students
3: Display interest
4: Exit
d) Read the user’s choice from the keyboard.
e) Return the choice read from the keyboard.
PostGraduate
-thesis: String
+<<constructor>> PostGraduate()
+<<constructor>> PostGraduate(String,String,Long,double)
+setThesis(String): void
+getThesis(): String
+toString(): String
+show(): void
+interest(): double
Write the PostGraduate class as per the class diagram. Remember to call the super class methods or constructors as needed. show() method This method is void and displays the details of a PostGraduate object as follows:
Student details Name: Mpho
Student number: 201812345
Loan amount: 10000.0
Thesis: I do not know
Code the method interest(). This method returns a double value calculated as follows: loanAmount times 10%.