Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Task 1 In this task, you will experiment with three sorting algorithms and compare their performances. a . Design a class named SortingAlgorithms with a

Task 1
In this task, you will experiment with three sorting algorithms and compare their performances.
a. Design a class named SortingAlgorithms with a main method.
b. Implement a static method bubbleSort that takes an array and its size and sorts.
the array using bubble sort algorithm.
c. Implement a static method selectionSort that takes an array and its size and sorts the array using selection sort algorithm.
d. Implement a static method insertionSort that takes an array and its size and sorts the array using insertion sort algorithm.
e. In the main method, generate random arrays of different sizes, 100,1000,5000,10000, etc.
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.
g. Prepare a table of execution times and write a short report to compare the performance of these three sorting algorithms.
Please note, you need to submit the Java code (.java files) and a MS Word document which includes the screenshots of the program to show each part is complete and tested. The document must also report on the recorded execution times and a discussion on the performance of algorithms.
Task 2
1. Create a class called Account.
- Having private fields custID, custname, custaddress, custphone and protected field balance
- Define a non-default constructor that takes inputs from driver program and sets appropriate fields.
- Create all get (accessor) methods for this class.
- Create all set (mutator) methods for this class.
- Create a method called add. This method takes one numerical input and adds it to balance.
- Create a method called subtract. This method takes one numerical input and subtracts it from balance.
- Create a method called yearlyinterest. This method increments the balance by 3% when called at the end of financial year.
- Write a toString method to display account details.
- Save this class to Account.java.
2. Write a Driver class that creates objects of type Account and add them in an ArrayList. The driver class should create objects of Account type and call the objects methods.
- Create a menu system for accessing different features.
o Add account.
o Display individual account.
o Display all accounts.
o Deposit to individual account
o Withdraw from individual account.
o Financial Year ending
o Exit.
- Create an ArrayList for different.
- Prompt the user to input account details and create Account object for 10 individual accounts and Add these Account objects to ArrayList.
- For deposit/withdrawal, the user needs to input custID and amount. The program should be able to find the appropriate account within ArrayList and update the amount.
- At the end of the financial year, all account balances should be updated with interests defined in the account class.
- Save this class to AccountDriver.java.
3. Create class diagrams for this scenario.
4. Attach screen shots of test cases.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

7th edition

978-1111825911, 1111825912, 978-1133684374, 1133684378, 978-111182591

More Books

Students also viewed these Databases questions