Programming Logic & Design Comprehensive
9th Edition
ISBN: 9781337669405
Author: FARRELL
Publisher: Cengage
expand_more
expand_more
format_list_bulleted
Question
Has to be done in C#
![6
936
3
123
2
4
write a
method that takes an array of boolean values and
returns a reference to an integer array of all element
indexes that have the value of true in the argument
array
Here is the method header
static int [] trueElements(bool[] b) // returns an
array with the positions (indexes) of where true
elements are in the array b
bool [] myBoo =
{true, false, false, true, false, false, true};
int[] result = trueElements (myBoo);
for (int i = 0; i < result.Length; i++)
Console.WriteLine(result[i]);
If your method is correct, the the console
should show the following values
Microsoft Visual Studio Debug Console](https://content.bartleby.com/qna-images/question/c9465122-b474-4786-84a0-ecefbaf46ea4/13999650-fa07-49d2-aecb-d859638d6395/d5ug2v_thumbnail.jpeg)
Transcribed Image Text:6
936
3
123
2
4
write a
method that takes an array of boolean values and
returns a reference to an integer array of all element
indexes that have the value of true in the argument
array
Here is the method header
static int [] trueElements(bool[] b) // returns an
array with the positions (indexes) of where true
elements are in the array b
bool [] myBoo =
{true, false, false, true, false, false, true};
int[] result = trueElements (myBoo);
for (int i = 0; i < result.Length; i++)
Console.WriteLine(result[i]);
If your method is correct, the the console
should show the following values
Microsoft Visual Studio Debug Console
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 2 steps with 1 images

Knowledge Booster
Similar questions
- The implementation of a queue in an array, as given in this chapter, uses the variable count to determine whether the queue is empty or full. You can also use the variable count to return the number of elements in the queue. On the other hand, class linkedQueueType does not use such a variable to keep track of the number of elements in the queue. Redefine the class linkedQueueType by adding the variable count to keep track of the number of elements in the queue. Modify the definitions of the functions addQueue and deleteQueue as necessary. Add the function queueCount to return the number of elements in the queue. Also, write a program to test various operations of the class you defined.arrow_forward(Program) Write a declaration to store the following values in an array named rates: 12.9, 18.6, 11.4, 13.7, 9.5, 15.2, and 17.6. Include the declaration in a program that displays the values in the array by using pointer notation.arrow_forwardIn previous chapters, you have created programs for the Greenville Idol competition. Now create a Contestant class with the following characteristics: The Contestant class contains public static arrays that hold talent codes and descriptions. Recall that the talent categories are Singing Dancing, Musical instrument, and Other. The class contains an auto-implemented property that holds a contestants name. The class contains fields for a talent code and description. The set accessor for the code assigns a code only if it is valid. Otherwise, it assigns I for Invalid. The talent description is a read-only property that is assigned a value when the code is set. Modify the GreenvilleRevenue program so that it uses the Contestant class and performs the following tasks: The program prompts the user for the number of contestants in this years competition; the number must be between 0 and 30. The program continues to prompt the user until a valid value is entered. The expected revenue is calculated and displayed. The revenue is $25 per contestant. The program prompts the user for names and talent codes for each contestant entered. Along with the prompt for a talent code, display a list of the valid categories. After data entry is complete, the program displays the valid talent categories and then continuously prompts the user for talent codes and displays the names of all contestants in the category. Appropriate messages are displayed if the entered code is not a character or a valid code.arrow_forward
Recommended textbooks for you
- Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningProgramming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage LearningC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage

Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,

EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT

C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning

Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning

C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr