In Java: -Using a BST Interface (Binary Search Tree)  -Create a class Disk. Disk contains four fields: model (String), size (int), measure (String, for GB or TB), and performance index (int). -Disk needs a constructor to initialize all fields, a toString method, and an equals. Make the class Comparable and write a compareTo method that compares Disks based on the size of the disk. Make sure your comparison accounts for the fact that some numbers are in GB and some are in TB. Write a method that will return true if the disk is the same size as the parms; parms are the size and measure("GB" or "TB"). Also write a method to create a Comparator which compares Disks based on the performance rating. -The client code should do the following: Write a function called build, which will open the disks.txt file, read in each disk and add it to the BST. For each disk the model is on the first line, and the second line contains the size, measure, and performance index. The BST is passed to build as a parameter. Write a function that prompts for size and measure and prints all disks of that size. In main create a BST of Disks which will order the Disks by size. Pass this BST to your build function. Then create an iterator to visit the disks in preorder, and use this iterator to print all the disks. Create another iterator to visit the disks in inorder and use this iterator to print all the disks. Call your function to print all Disks of a given size. Create another BST that is ordered by performance rating. Create an iterator for your first BST (ordered by size). Create a loop and in the loop body add each Disk returned by next() to your new BST (ordered by performance rating). Create an iterator to traverse your new BST (ordered by performance rating) in order, and use it to print all the Disks in a BST disks.txt file attached.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

In Java:

-Using a BST Interface (Binary Search Tree) 

-Create a class Disk. Disk contains four fields: model (String), size (int), measure (String, for GB or TB), and performance index (int).

-Disk needs a constructor to initialize all fields, a toString method, and an equals. Make the class Comparable and write a compareTo method that compares Disks based on the size of the disk. Make sure your comparison accounts for the fact that some numbers are in GB and some are in TB. Write a method that will return true if the disk is the same size as the parms; parms are the size and measure("GB" or "TB"). Also write a method to create a Comparator which compares Disks based on the performance rating.

-The client code should do the following:

  • Write a function called build, which will open the disks.txt file, read in each disk and add it to the BST. For each disk the model is on the first line, and the second line contains the size, measure, and performance index. The BST is passed to build as a parameter.
  • Write a function that prompts for size and measure and prints all disks of that size.
  • In main create a BST of Disks which will order the Disks by size. Pass this BST to your build function. Then create an iterator to visit the disks in preorder, and use this iterator to print all the disks. Create another iterator to visit the disks in inorder and use this iterator to print all the disks.
  • Call your function to print all Disks of a given size.
  • Create another BST that is ordered by performance rating. Create an iterator for your first BST (ordered by size). Create a loop and in the loop body add each Disk returned by next() to your new BST (ordered by performance rating).
  • Create an iterator to traverse your new BST (ordered by performance rating) in order, and use it to print all the Disks in a BST

disks.txt file attached.

Crucial M550
512 GB 1174
Corsair Neutron XT
480 GB 1216
Samsung 850 Evo
512 GB 1187
Samsung 845DC Pro
800 GB 1118
Toshiba HG6
256 GB 1016
Samsung 850 Pro
1 TB 1191
Samsung 850 Evo
500 GB 1206
SanDisk Extreme II
240 GB 1122
Crucial MX200
2 TВ 1028
Samsung XP 941
256 GB 1189
Samsung 850 Evo
128 GB 1180
Samsung 840 Evo
1 тВ 1196
Plexter. M6S
256 GB 1119
Corsair Neutron XT
960 GB 1231
ocz Vertex 4
128 GB 1080
Toshiba THNSNH512GCST
512 GB 999
Transcend SSD370
256 GB 953
Samsung 845DC Evo
960 GB 1058
Transcribed Image Text:Crucial M550 512 GB 1174 Corsair Neutron XT 480 GB 1216 Samsung 850 Evo 512 GB 1187 Samsung 845DC Pro 800 GB 1118 Toshiba HG6 256 GB 1016 Samsung 850 Pro 1 TB 1191 Samsung 850 Evo 500 GB 1206 SanDisk Extreme II 240 GB 1122 Crucial MX200 2 TВ 1028 Samsung XP 941 256 GB 1189 Samsung 850 Evo 128 GB 1180 Samsung 840 Evo 1 тВ 1196 Plexter. M6S 256 GB 1119 Corsair Neutron XT 960 GB 1231 ocz Vertex 4 128 GB 1080 Toshiba THNSNH512GCST 512 GB 999 Transcend SSD370 256 GB 953 Samsung 845DC Evo 960 GB 1058
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 2 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY