Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Visual Basic Programming 1) Write code for a function named opposites that takes two integer arguments named x and y, and returns true if they

Visual Basic Programming

1) Write code for a function named opposites that takes two integer arguments named x and y, and returns true if they are opposite in sign but equal in value, and false otherwise. For example, -1,1 are opposites, while 2 and 2 are not opposites, nor are 1 and 3 or -4 and 5. Do not include any comments or extra lines of code. Hint, if x and y are to be tested, then if x is equal to -1*y then they are opposites.

2) Assume that array Data is declared as Integer, and avg is the average of all the numbers in Data. Write code for a for-loop that counts the number of elements in Data that are above than the average avg.

Do not declare Data or make any assumptions on its size. Do not include any comments or extra lines of code.

Hint: You will need a counter variable inside the for loop other than the for loop counter.

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

Conceptual Database Design An Entity Relationship Approach

Authors: Carol Batini, Stefano Ceri, Shamkant B. Navathe

1st Edition

0805302441, 978-0805302448

More Books

Students also viewed these Databases questions