1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Troyanec [42]
2 years ago
15

Assume that the following method header is for a method in class A.

Computers and Technology
1 answer:
fenix001 [56]2 years ago
8 0

Answer:

The answer to the given question is option "B".

Explanation:

In the question it is given that there is a method name is "displayValue()" is defined in this method we pass an integer variable that is "value" and in this method, we calculate some values, and call this method So, the correct code for calling this method is the option "B" and others options are not correct that can be described as:

  • In option, A Calling time of the function we do not use the return type, That's why this option is not correct.
  • In option, C Calling time of the function we do not pass any data type of variable, That's why this option is not correct.
  • In option, D we do not use semicolon in the function call, which is wrong.

That's why option "B" is correct.

You might be interested in
Technician A says that wheel speed sensors are a highly probable cause of illuminated EBC warning lamps. Technician B says that
Blababa [14]

Technician A because

3 0
2 years ago
Where is the Outlook Search Folder located?
melamori03 [73]
When you go to the mail go to file and click new it should be in there as search folder
6 0
3 years ago
Similarities between human and computer​
Zielflug [23.3K]

Answer: Both have a center for knowledge; motherboard and brain. Both have a way of translating messages to an action. Both have a way of creating and sending messages to different parts of the system.

5 0
3 years ago
Integers and booleans. Write a program RightTriangle that takes three int command-line arguments and determines whether they con
icang [17]

Answer:

<em>The programming language is not stated;</em>

<em>I'll answer using C++</em>

#include<iostream>

#include<cmath>

using namespace std;

int main()

{

int side1, side2, side3;

cout<<"Enter the three sides of the triangle: "<<endl;

cin>>side1>>side2>>side3;

if(side1<=0 || side2 <= 0 || side3 <= 0) {

 cout<<"Invalid Inputs";

}

else {

 if(abs(pow(side1,2) - (pow(side2,2) + pow(side3, 2)))<0.001) {

  cout<<"Right Angled";

 }

 else if(abs(pow(side2,2) - (pow(side1,2) + pow(side3, 2)))<0.001) {

  cout<<"Right Angled";

 }

 else if(abs(pow(side3,2) - (pow(side2,2) + pow(side1, 2)))<0.001) {

  cout<<"Right Angled";

 }

 else {

  cout<<"Not Right Angled";

 }

}

return 0;

}

Explanation:

The following line declares the three variables

int side1, side2, side3;

The next line prompts user for input of the three sides

cout<<"Enter the three sides of the triangle: "<<endl;

The next line gets user input

cin>>side1>>side2>>side3;

The following if condition checks if any of user input is negative or 0

<em> if(side1<=0 || side2 <= 0 || side3 <= 0) { </em>

<em>  cout<<"Invalid Inputs"; </em>

<em> } </em>

If otherwise

else {

The following if condition assumes that side1 is the largest and test using Pythagoras Theorem

<em>if(abs(pow(side1,2) - (pow(side2,2) + pow(side3, 2)))<0.001) { </em>

<em>   cout<<"Right Angled"; </em>

<em>  } </em>

The following if condition assumes that side2 is the largest and test using Pythagoras Theorem

<em>  else if(abs(pow(side2,2) - (pow(side1,2) + pow(side3, 2)))<0.001) { </em>

<em>   cout<<"Right Angled"; </em>

<em>  } </em>

The following if condition assumes that side3 is the largest and test using Pythagoras Theorem

<em>  else if(abs(pow(side3,2) - (pow(side2,2) + pow(side1, 2)))<0.001) { </em>

<em>   cout<<"Right Angled"; </em>

<em>  } </em>

If none of the above conditions is true, then the triangle is not a right angles triangle

<em>  else { </em>

<em>   cout<<"Not Right Angled"; </em>

<em>  } </em>

}

return 0;

Download cpp
4 0
3 years ago
1. Scrieţi un program care citeşte un număr natural n şi determină produsul cifrelor impare ale lui n. De exemplu, pentru n = 23
saveliy_v [14]

Answer:

1.  

num1 = input("Enter the value of n")  

n = int(num1)  

def calc(n):  

Lst = []  

while n > 0:  

remainder = n % 10  

Lst.append(remainder)  

quotient = int(n / 10)  

n = quotient  

i = len(Lst) - 1  

sum = 1  

for i in range(0, len(Lst)):  

if(i % 2 != 0):  

sum *=Lst[i];  

else:  

continue  

print(sum)  

return(0)  

\ r2

num=input("Enter the value of n")

arr=[12,-12,13,15,-34,-35,35,42]

def div7positive():

  sum = 0

  m = 0

  i = 0

  while m <= 7:

      if(arr[i]>=0 and arr[i]%7 == 0):

          sum +=arr[i]

      i = i + 1

      m += 1

       

   

  print("sum of number divisible by 7 and positive is", +sum);

div7positive()

\ r

\ r3.Write an algorithm that reads a natural number n and calculates the sum:

\ rS = 1 / (1 * 2) + 1 / (2 * 3) + 1 / (3 * 4) +… + 1 / ((n-1) * n)

\ r

num=input("Enter the value of n")

def sumseries():

  sum = 0

  m= 0

  while m <= 7:

      sum +=1/((int(num)-1)*int(num))

      m += 1

  print("sum of series is", +sum)

sumseries()

\ R4. Read a natural number n. Calculate the sum of its own divisors n. For example, for n = 12, the sum of its own divisors is 2 + 3 + 4 + 6 = 15

num=input("Enter the value of n")

def sumdivisors():

  sum = 0

  m= 2

  while m <= int(num):

      if int(num) % m == 0:

          sum += m

      m += 1

  print("sum of divisors is", +sum)

sumdivisors()\ r

\ R5. We read a natural number n and then whole numbers. Calculate and display the sum of the natural numbers between 10 and 100. For example, if n = 5 and then read 30, –2, 14, 200, 122, then the sum will be 44 (that is, 30 + 14).

\ r

Lst = []  

num=input("Enter the value of n")

i = 0

while i<= int(num):

  num1=input("Enter the element of array")

  Lst.append(int(num1));

  i += 1

def numbet0and100():

  sum = 0

  m= 0

  while m <= int(num):

      if Lst[m] <= 100 or Lst[m] >=0:

          sum += Lst[m]

      m += 1

  print("sum of numbers between 0 and 100 is", +sum)

numbet0and100()

\ R6. A natural number n of maximum 4 digits is read. How many digits are in all numbers from 1 to n? For example, for n = 14 there are 19 digits, and for n = 9 there are 9 digits.

\ r

num = input("Enter the value of n")

n = int(num)

print(“sum as required is:” (n -9) + n)  

 

\ R7. Read the natural numbers n and S, where n can be 2, 3, 4 or 5. Show all the numbers of n digits that have the numbers in strictly ascending order, and the sum of the digits is S. For example, for n = 2 and S = 10, 19, 28, 37, 46 will be displayed.

num = input("Enter the value of n")

n = int(num)

Lst = []

def calc(n):

  i = 1

  total = pow(10,n)

  while i <= total:

      j = i

      while j > 0:

          remainder = j % 10  

          Lst.append(remainder)

          quotient = int(j / 10)

          if quotient > 0:

              j = quotient

          else:

              length = len(Lst) - 1

              sum = 0

              while length >= 0:

                  sum += Lst[length]

                  length = length - 1

              if sum == pow(10,n):

                  print(j)

              k = len(Lst)

              del Lst[0:k]

      i = i + 1

  return(0)

calc(n)

\ r

\ R8. We consider the row 1, 1, 2, 3, 5, 8, 13, ... in which the first two terms are 1, and any other term is obtained from the sum of the preceding two. Write an algorithm that reads a natural number n and displays the first n terms of this string. For example, for n = 6, 1, 1, 2, 3, 5, 8 will be displayed.

\ r

nterm = int(input("What number of terms do you want?"))

a, b = 0, 1

totalcount = 0

if nterm <= 0:

 print("Please input a positive number")

elif nterm == 1:

 print("Fibonacci number upto which",nterm,":")

 print(a)

else:

 print("Fibonacci series:")

 print(nterm)

 while totalcount < nterm:

     print(a)

     nth = a + b

     a = b

     b = nth

     totalcount += 1

 

\ 9. Write an algorithm that reads two natural numbers n1 and n2 and displays the message "yes" if the sum of the squares of the digits of n1 is equal to the sum of the numbers of n2 or "no" otherwise. For example, for n1 = 232 and n2 = 881, "yes" will be displayed, and for n1 = 45 and n2 = 12, "no" will be displayed.

num1 = input("Enter the value of n")

num3 = input("Enter the value of n")

n = int(num1)

num2 = int(num3)

def calc(n):

  Lst = []

  while n > 0:

      remainder = n % 10  

      Lst.append(remainder)

      quotient = int(n / 10)

      n = quotient

       

  i = len(Lst) - 1

  sum = 0

  while i >= 0:

      sum += Lst[i]* Lst[i]

      i = i - 1

  return(sum)

def calc1(num2):

  Lst = []

  while num2 > 0:

      remainder = num2 % 10  

      Lst.append(remainder)

      quotient = int(num2 / 10)

      num2 = quotient

       

  i = len(Lst) - 1

  sum = 0

  while i >= 0:

      sum = Lst[i] + Lst[i]

      i = i - 1

  return(sum)

a = calc(n)

b = calc1(num2)

if a == b:

  print("yes")

else:

  print("No")

\ r

\ R10. Write an algorithm that reads a natural number n and displays the message "yes" if all of its n numbers are distinct, or "no" if n does not have all the distinct digits. For example, for n = 37645 it will display "yes" and for 23414 it will show "no".

\ r

num1 = input("Enter the value of n")

n = int(num1)

def calc(n):

  Lst = []

  while n > 0:

      remainder = n % 10  

      Lst.append(remainder)

      print( remainder)

      quotient = int(n / 10)

      n = quotient

       

  flag = 1

  for i in range(0, len(Lst)):

      for j in range(i+1, len(Lst)):    

          if Lst[i] == Lst[j]:    

              flag = 0

              break

           

  if flag == 1:

      print("YES")

  else:

      print("NO")

  return(0)

Explanation:

Please check answer.  

3 0
2 years ago
Other questions:
  • Apart from confidential information, what other information does NDA help to outline?
    15·1 answer
  • What are the conditions for using still photos in a video program
    6·1 answer
  • What is data? and types ??
    9·2 answers
  • 1. Consider a direct-mapped cache that can accommodate 8Mbytes from a main memory, that uses a 32-bit address and 32-byte blocks
    5·1 answer
  • Write at least complete set of HTML code to hyperlink to “Home.html”..
    8·1 answer
  • Here is the problem specification: An Internet service provider has three different subscription packages for its customers: Pac
    5·1 answer
  • Which of the following statements best compares and contrasts the role of editors in a television news room and editors at a new
    5·1 answer
  • 1. Select two forms of case designed suitable for ATX power supply and
    13·1 answer
  • Tgif
    7·1 answer
  • Drag the tiles to the boxes to form correct palrs.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!