Create a KeyIndex class with the following properties :  Fields:  int [ ] k;  Description An array of integers.  Note: You may maintain another global variable(java)/instance variable(python) if needed (but you can’t use more than one).   Constructor:(10 marks) KeyIndex(int [ ]a) Description: This constructor takes an array of integers a and populates array k with the element in a as indices into k.   Note: make sure the build-up of your array k supports negative and non-distinct integers. Methods: search (int val)     Description: This method searches for the value val within the array and returns true if found or false otherwise.   sort ()            Description: This method will return the sorted form of the array that had been passed into the constructor.

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter9: Using Classes And Objects
Section: Chapter Questions
Problem 1CP: In previous chapters, you have created programs for the Greenville Idol competition. Now create a...
icon
Related questions
Question
100%

Solve this using python language

Create a KeyIndex class with the following properties : 

Fields: 

int [ ] k; 

Description

An array of integers. 

Note: You may maintain another global variable(java)/instance variable(python) if needed (but you can’t use more than one).

 

Constructor:(10 marks)

KeyIndex(int [ ]a)



Description:

This constructor takes an array of integers a and populates array k with the element in a as indices into k.

 

Note: make sure the build-up of your array k supports negative and non-distinct integers.

Methods:

search (int val)    

Description:

This method searches for the value val within the array and returns true if found or false otherwise.

 

sort ()           

Description:

This method will return the sorted form of the array that had been passed into the constructor.

NOTE: Create a tester class or write tester statements to check whether the methods in your KeyIndex class work properly.                                                          

Expert Solution
steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
Program on Numbers
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage