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%.
Student
-name: String
-studentNumber: long
-loanAmount: double
+<<constructor>> Student()
+<<constructor>> Student(String, long, double)
+getName(): String
+getStudentNumber(): long
+getLongAmount(): double
+setName(String): void
+setStudentNumber(long): double
+setLoanAmount(double): void
+toString(): String
+show(): void
+interest(): double
show() method This method is void and does not have any parameters. This method displays the details of a Student object as follows:
Student details Name: Smittie
Student number: 12345
Loan amount: 10000.0
Coding for interest() method public double interest() { return loanAmount*.05; }
Write a program in Java to perform the following operations on Matrix using
multithreading. Get the required input matrix from the user and after that run
three threads to perform the following operation.
a. Addition
b. Subtraction
c. Multiplication
Write a menu driven program in Java to perform the operations on an Integer
Queue by making use of the concept of interfaces. And create custom
exceptions to deal with the following situations
A non-integer value is encountered in the queue
b. Insert operation when the Queue if full
c. Remove operation when queue is empty.
Write a java program to create an Account class and define constructors in it. Inherit Saving_Bank_Account class and Current_Bank_Account class from the Account class. Override constructors of Account class in Saving_Bank_Account and Current_Bank_Account classes. Define appropriate methods to operate these accounts. Make necessary assumptions. Give proper comment in your program to increase redability.