Task 1 (50 marks) In this task, you will experiment with three sorting algorithms and compare their performances. a. Des
Posted: Sun May 15, 2022 10:23 am
Task 1 (50 marks) In this task, you will experiment with three sorting algorithms and compare their performances. a. Design a class named SortingAlgorithms with a main method. (5 marks) b. Implement a static method bubbleSort that takes an array and its size and sorts the array using bubble sort algorithm. (5 marks) c. Implement a static method selectionSort that takes an array and its size and sorts the array using selection sort algorithm. (5 marks) d. Implement a static method insertion Sort that takes an array and its size and sorts the array using insertion sort algorithm. (5 marks) e. In the main method, generate random arrays of different sizes, 100, 1000, 5000, 10000, etc. (5 marks) f. Call each of the aforementioned sorting algorithms to sort these random arrays. You need to measure the execution time of each and take a note. (10 marks) 8. Prepare a table of execution times and write a short report to compare the performance of these three sorting algorithms. (15 marks) Please note, you need to submit the Java code with a Ms Word document (or a PDF file) which includes the screenshots of the program to show each part is complete and tested. The document must also report
B Task 2 (50 marks) Your job is to implement system for a video rental store to manage the videos and the customers. Each customer registers and can borrow up to two videos simultaneously for maximum of 5 days. If the video is not returned on time, a fine amount of 15/day is applied Launch Buel (or Eclipse) and create a new project and name it as Task and save it in the Task2 folder in your submission. Then, create the classes you are asked in the following parts of the question {a) In the project file, create a class for customer name it Customer). Identify the required attributes for customers and the data type of each attribute. (5 marks) (b) Provide comments in the Customer class and briefly explain each attribute (1 mark) Implement constructors, setter and getter methods for class Customer (4 marks) (d) Provide comments for constructors, setter and getter methods using Javadoc. (1 mark) (e) Provide a main method for the Customer class and define two objects and test your methods. You need to include a screenshot of the output of your program in the solution document to show that your methods are working correctly. (5 marks) (c) In the project file, create a class for video frame it Video). Identify the required attributes for videos and the type of each attribute Back
DOS M. We ment Problem Solving Exercise.pdf My Overview | Baahearts. He 134 6 (8) Provide comments in the Video class and briefly explain each attribute. 15 mars (1 mark) (h) Implement constructors, getter and setter methods for class Video (5 marks) 00 Provide comments for constructors, setter and getter methods using Javadoc (1 mark) 01) Implement these three methods for Video class: (12 marks, 4 marks each) public void rent(customer, Date) //It rents the item to a customer from a specific date public boolean isOverdue(Date) //If the item is on loan and is not returned on a specific date, the method returns true, otherwise, it return false. public int calculate FineDate) //If the item is overdue, the fine is calculated for the delay, otherwise, it returns 0.
ament 3 Problem Solving cerised Www DIC 3/3 11 (k) Provide a main method for the video class and define several objects of video and customer to test your methods. You need to include a screenshot of the output of your program in the solution document to show that your methods are working correctly (10 marks) Hint: For this task. you need to use class Date Java provides the Date class available in Java.util package, this class encapsulates the current date and time. The following program simply shows how can you use this class import java.util.Date: public class DateExample public statio void main(string args) Instantiate a Date object Date current Date = new Date() V/ Print the current time and date using tostring) System.out.println (currentDate.toString(): The output of the program will look like this: Tue Mar 08 12:27:56 UTC 2022
B Task 2 (50 marks) Your job is to implement system for a video rental store to manage the videos and the customers. Each customer registers and can borrow up to two videos simultaneously for maximum of 5 days. If the video is not returned on time, a fine amount of 15/day is applied Launch Buel (or Eclipse) and create a new project and name it as Task and save it in the Task2 folder in your submission. Then, create the classes you are asked in the following parts of the question {a) In the project file, create a class for customer name it Customer). Identify the required attributes for customers and the data type of each attribute. (5 marks) (b) Provide comments in the Customer class and briefly explain each attribute (1 mark) Implement constructors, setter and getter methods for class Customer (4 marks) (d) Provide comments for constructors, setter and getter methods using Javadoc. (1 mark) (e) Provide a main method for the Customer class and define two objects and test your methods. You need to include a screenshot of the output of your program in the solution document to show that your methods are working correctly. (5 marks) (c) In the project file, create a class for video frame it Video). Identify the required attributes for videos and the type of each attribute Back
DOS M. We ment Problem Solving Exercise.pdf My Overview | Baahearts. He 134 6 (8) Provide comments in the Video class and briefly explain each attribute. 15 mars (1 mark) (h) Implement constructors, getter and setter methods for class Video (5 marks) 00 Provide comments for constructors, setter and getter methods using Javadoc (1 mark) 01) Implement these three methods for Video class: (12 marks, 4 marks each) public void rent(customer, Date) //It rents the item to a customer from a specific date public boolean isOverdue(Date) //If the item is on loan and is not returned on a specific date, the method returns true, otherwise, it return false. public int calculate FineDate) //If the item is overdue, the fine is calculated for the delay, otherwise, it returns 0.
ament 3 Problem Solving cerised Www DIC 3/3 11 (k) Provide a main method for the video class and define several objects of video and customer to test your methods. You need to include a screenshot of the output of your program in the solution document to show that your methods are working correctly (10 marks) Hint: For this task. you need to use class Date Java provides the Date class available in Java.util package, this class encapsulates the current date and time. The following program simply shows how can you use this class import java.util.Date: public class DateExample public statio void main(string args) Instantiate a Date object Date current Date = new Date() V/ Print the current time and date using tostring) System.out.println (currentDate.toString(): The output of the program will look like this: Tue Mar 08 12:27:56 UTC 2022