diff_months: 11

Operating System Assignment

Download Solution Now
Added on: 2023-06-14 06:17:12
Order Code: //fb
Question Task Id: 0
  • Country :

    Australia

TASKS

TASK 1.READING DATA. [10 MARKS]

Create a Java class that can retrieve information on 1,000 cars from a text file named "cars.cav". This file uses the Comma Separated Values (CSV) format, meaning each row of data is separated by commas. The file includes a header row specifying the names of the three columns: VIN, Name, and DOB. Your task is to design and implement the class that can read and extract data from this file.

  • VIN (Vehicle Identification Number). Identifier of length 17 characters (letters and numbers), unique for each car.
  • Name. The first name and last name of the car owner. The first and last names have no spaces, except the space separating them.
  • DOB (Date of Birth). The day the car owner was born in. Ranges from 1980-01- 03 to 2009-12-18, inclusive. Formatted as YYYY-MM-DD.

14june-1686722563.jpg

Your program must read and store the data of the cars in an array of objects. Furthermore, the method should write the cars data into a numbered and neatly formatted text file called formatted_cars.txt, as shown in the sample below. For good formatting make sure to use formatted printing printf(). Notice the change in order of columns.

The data in "VIN" and "No." columns should be modified according to the last two digits of your KU ID. For example, if your KU ID is 1000123456, then the ID would be 56.

The "No." column should start from "1D+1" and end at "ID+1000", for the aforementioned example, starting at 57 and ending at 1057. And in the VIN column, the last two digits of the VIN number should be "ID". For instance, if the VIN number is "00XYZRZSUYNYHQ3EK" and ID is "56", then the VIN number should be 700XYZRZSUYNYHQ3EK56".

14june1-1686722569.jpg

TASK 2. SORTING DATA. [20 MARKS]

Create a class that can sort a set of car data in ascending order based on the name of their owner. This sorting class must correctly implement the following four sorting algorithms:

  • BubbleSort() (Short bubble sort algorithm)
  • QuickSort () (Optimized such that it has no unnecessary recursive calls, eg when FL)
  • HeapSort()
  • MergeSort()

Apply the sorting algorithms to the array of car objects, and save the sorted arrays into the following files, numbered, and formatted neatly:

  • bsorted.txt (for bubble sort)
  • qsorted.txt (for quick sort)
  • hsorted.txt (for heap sort)
  • maorted.txt (for merge sort)

Make sure that you maintain the integrity of the data after sorting

TASK 3. QUANTITATIVE ANALYSIS. [30 MARKS]

Adjust the sorting algorithms to count the number of operations (type of operations detailed below in the tables) performed. And change the calling function such that you record the time the algorithms take.

You will need to create 4 arrays of cars (number of elements detailed below in the tables) and apply the sorting algorithms on these unsorted arrays. Then again, you need to re- apply the sorting algorithms on the sorted arrays.

TABLE 1.BUBBLE SORT ON UNSORTED ARRAY.

14june2-1686722574.jpg

TABLE 2 BUBBLE SORT ON SORTED ARRAY

14june3-1686722579.jpg

TASK 4. QUALITATIVE ANALYSIS. [30 MARKS]

For each of the sorting algorithms, report your results from the previous task as to why and how the algorithm performed as the number of elements increased and as the data got sorted.

You need to justify the retrieved number of operations in the unsorted case of 1,000 elements and estimate how these numbers can be calculated. Moreover, correlate the time the algorithms took with its big-O time complexity.

Finally, investigate whether heap sort is a stable algorithm or not, and describe what does that mean.

TASK 5. DISCUSSION. [10 MARKS]

Compare the performance of the four sorting algorithms in terms of their execution time and big-0 time complexity-not 7(n) for both sorted and unsorted arrays. Discuss and justify how each algorithm can be optimal in a certain use case.

NOTES

HINTS

  • Make sure that when you sort the cars based on a certain column value, you also sort the other parts of the car data.
  • Note that you should rewrite the sorting algorithms given to you in class to cater for ordering based on the age, name, and VIN.
  • You need to write a driver class to use the algorithms for testing.
  • You need to write the program in an object-oriented style (must have at least two classes).

CODE

  • All submitted code should be properly documented and written in a good programming style with comments and proper indentation.
  • You are only allowed to use code from the notes in class or lab with no change of structure or naming style (no internet code will be accepted).

Are you struggling to keep up with the demands of your academic journey? Don't worry, we've got your back! Exam Question Bank is your trusted partner in achieving academic excellence for all kind of technical and non-technical subjects.

Our comprehensive range of academic services is designed to cater to students at every level. Whether you're a high school student, a college undergraduate, or pursuing advanced studies, we have the expertise and resources to support you.

To connect with expert and ask your query click here Exam Question Bank

  • Uploaded By : Katthy Wills
  • Posted on : June 14th, 2023
  • Downloads : 0
  • Views : 105

Download Solution Now

Can't find what you're looking for?

Whatsapp Tap to ChatGet instant assistance

Choose a Plan

Premium

80 USD
  • All in Gold, plus:
  • 30-minute live one-to-one session with an expert
    • Understanding Marking Rubric
    • Understanding task requirements
    • Structuring & Formatting
    • Referencing & Citing
Most
Popular

Gold

30 50 USD
  • Get the Full Used Solution
    (Solution is already submitted and 100% plagiarised.
    Can only be used for reference purposes)
Save 33%

Silver

20 USD
  • Journals
  • Peer-Reviewed Articles
  • Books
  • Various other Data Sources – ProQuest, Informit, Scopus, Academic Search Complete, EBSCO, Exerpta Medica Database, and more