Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Task 2: in C++ Please compile & execute code in Command Prompt or Terminal / DO NOT USE IDE Please Include Snipping Photo of the

Task 2:

in C++

Please compile & execute code in Command Prompt or Terminal / DO NOT USE IDE

Please Include Snipping Photo of the Whiteboard / Pseudo Code of program below for hardcoded common algorithms

Implement a class for Task 1 and Hardcode algorithms for Linear Search, Middle Value, First Value, Last Value, Highest Value, Lowest Value, and Bubble Sort.

Main Function: Declare and fill an array with 1000 random integers between 1 - 1000.

Class will contain the methods below and an array as the data structure.

Please use comments to identify constructors and methods in the program.

Method 1:

Access each element

For {}

Output all values

Method 2:

Access each element

For {}

Sum values at each index

Output the sum of all values

Sum = 0

Sum = sum + sample[i]

Method 3:

Output all odd numbers

Odd: if(sample[i] % 2! =0)

Method 4:

Output all even numbers

Even : if (sample[i] % 2 = 0)

Method 5:

Enter a search value / Implement Linear Search

Method 6:

New

l

Output Middle Value (Values in the Middle)

Not Average

Method 7:

Output First Value in the Array

Method 8:

New

Output Last Value in the Array

Method 9:

New

Access each element

FOr {}

if(high)

Output the Highest Value and its location in the array. (Hardcode the algorithm.)

Max_value = sample[0]

If (sample[i] > max_value)

Max_value = sample[i]

Method10:

New

Access each element

FOr {}

if(low)

Output the Lowest Value and its location in the array. (Hardcode the algorithm.)

low_value = sample[0]

If (sample[i] > low_value)

low_value = sample[i]

Method 11:

New

Sort and then output values. Hardcode the bubble sort algorithm you will implement.

  • Attach a snipping photo of source code and output

  • Make sure to include photo class

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

Students also viewed these Databases questions

Question

In what ways can a company repurchase its stock?

Answered: 1 week ago