Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

If anyone could make a comment heavy version to help me understand how this code works when properly implemented I would greatly appreciate it. pre

image text in transcribedimage text in transcribed

If anyone could make a comment heavy version to help me understand how this code works when properly implemented I would greatly appreciate it.

pre assignment GetNumber Reuse the GetNumber) method that you have been refining in the previous two labs. Get Array Using your GetNumber) method, create a method that will read in an array from the console. Begin by reading a number from the console which represents the size of the array to be read in. Then proceed to read in the specified number of elements. Make sure to store the values obtained from the console in an array. PrintArray Develop a method that prints all the elements within the array passed to it. Exerise 7-4 Using the functions mentioned above, develop a routine that finds the longest consecutive sequence of integers. Should two integer values have consecutive sequences of the same length, the sequence composed of greater values would be the result (see example 2) Example 1: Consider the set f1, 2, 3, 3, 3, 3, 4, 5, 5, 5), the result would be B, 3, 3, 3) Example 2: Consider the set f1, 2, 5, 5, 5, 4,4,4), even though there are consecutive sequences composed of 5's and 4's of length 3 the result should be the sequence composed of greater values, therefore the result is be [5, 5, 5) Exercise 7-5 Using the functions mentioned above, devel op a routine that finds the longest consecutive sequence of consecutively increasing integers. In the event that there are two sequences that have the same length, the result should be the sequence that contains greater values (see example 2) Example 1: Consider the set f1, 2, 4, 4, 5, 6, 7), the result would be 14, 5, 6, 7) Example 2: Consider the set 12, 4, 3, 4, 5, 8, 1, 2, 3) where there are two subsets B, 4, 5) and (1, 2, 3) that satisfy the criteria. Your result should be B, 4, 5) as it is the subset that satisfies the criteria with the greatest values. 1 using System; nanespace ConsolcAppz public class Program public static void Mainstring) args) int[ trp, res; tmp GctArray) res - Excrcice7 4(tmp): PrintArray(res); // Exercice 15 public static int? GetNumber() throw new NotImplcnentedExccptionO: 21 23 public static int[] GetArrayO 1/ get array should pronpt for a valid size of array, // and keep asking until it gets a valid number 1/ it should then input values ignaring bad values until there arc n // valid iters in the array // if a size of zero is entered return null throw new NotImplcnentedExccption)O: 29 public static void PrintArrayint[) x,int perline-2a) throw new NotImplcnentedExccptionO: public static int[ Exercicc7 4(int[] x) Write a progran, which finds the first maxinal scquence of consccutive qual clerents in an array. E8: . 1, 2, 3. 2, 2, 2, ) > 2, 2,2) throw new NotImplenentedExceptionO public static int[] Exercicc7 s(int] x) Writc a progran, which finds the maxinal sequence of consecutively placed increasing integers. Example:(3, 2, 3, 4,2,2,4(2, 3, 4) 53 59

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

Databases DeMYSTiFieD

Authors: Andy Oppel

2nd Edition

0071747990, 978-0071747998

More Books

Students also viewed these Databases questions

Question

What is its position?

Answered: 1 week ago

Question

What are the organizations relationship goals on this issue?

Answered: 1 week ago