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
Contact [7]
3 years ago
8

class bClass{public:void setX(int a);//Postcondition: x = a;void print() const;private:int x;};class dClass: public bClass{publi

c:void setXY(int a, int b);//Postcondition: x = a; y = b;void print() const;private:int y;};Which of the following correctly sets the values of x and y?a. void dClass::setXY(int a, int b){x = bClass.setX(a);b = y;}b. void dClass::setXY(int a, int b){x = bClass::setX(a);y = bClass::setY(b);}c. void dClass::setXY(int a, int b){x = a;y = b;}d. void dClass::setXY(int a, int b){bClass::setX(a);y = b;}
Computers and Technology
1 answer:
MaRussiya [10]3 years ago
6 0

Answer:

The answer to the given question in the option "a".

Explanation:

In the given c++ program the correct sets value of x and y is option a:

void dClass::setXY(int a, int b) //function implementation

{ //function body.

x = bClass.setX(a); //variable x hold value of setX() function.

b = y;  //variable b holds value of y.  

}

And other option are not correct that can be described as:

  • In option b, x is private variable of the base class that is inherit by the derived class but variable y is not part of the base class. that's why it is wrong.
  • In option c, x= a is correct but y=b is not correct. that's why it is wrong.
  • In option d we access the value of the private variable x that is a part of the base class but in this we not use any variable that holds its value. that's why it is wrong.

So the answer to this question is the option "a".  

You might be interested in
Consider the following code:
Volgvan

Answer:

The code will get stuck in an infinite loop.

Explanation:

Since val is decreasing by 1 each time it meets the criteria of being smaller than 10, your code will get stuck in an infinite loop since val will always be smaller than 10.

Hope this helps :)

8 0
2 years ago
This program needs to be written in Java. Along with NO For/while loops, and no methods.
Umnica [9.8K]
The only way without a while loop and no method I can think of is use switch with every possible variation of the four digit binary which is 15.

Here is the starter code:

import java.util.Scanner;
public class MyClass {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int digit = sc.nextInt();
switch(digit) {
case 0000:
System.out.println("0");
break;
case 0001:
System.out.println("1");
break;
case 0010:
System.out.println("2");
break;
case 0011:
System.out.println("3");
break;
case 0100:
System.out.println("4");
break;

… (fill in other cases)


}
}
}

Use this link: https://www.electronics-tutorials.ws/binary/bin_3.html

There might be a better way, but without loops or methods this is all I got.
6 0
2 years ago
Entering the search criteria "B?" would yield which of the following results? A. Bedford B. Be C. Birmingham D. Bentonville
lidiya [134]
It would be either one i belive... but i would choose C if your talking about google
4 0
3 years ago
Read 2 more answers
Write a python function genRandomVect that returns a random 1d numpy array of size (50,) where each element is an integer sample
SSSSS [86.1K]

Answer:

import numpy as np

def genRandomVect():

   arr = np.random.choice(range(100),size=(50,),replace=False)

   return arr

 

print("Random 1D numpy array where each element is an integer sampled from: [0, 100) ")

print( genRandomVect() )

Explanation:

  • Create a function to create a numpy array with random integers in range[0,100) with no duplicates
  • Use the random.choice to select random values from range[0,100)  and size attribute to take the size of the required array .
  • Finally return the numpy array.

6 0
3 years ago
A dietician wants you to write a program that will calculate the number of calories a person can lose by walking at a slow pace
gregori [183]

Answer:

The pseudocode is as follows

1. Input Steps

2. Input Day

3. Miles = Steps/2000

4. Calories = 65 * Miles

5. Print Calories

6. Stop

Explanation:

This line gets the number of steps for the day

1. Input Steps

This line gets the current day

2. Input Day

The line calculates number of miles

3. Miles = Steps/2000

This line calculates the calories lost

4. Calories = 65 * Miles

This line prints the calories lost

5. Print Calories

The pseudocode ends here

6. Stop

6 0
3 years ago
Other questions:
  • This is Tim’s first job. He is not familiar with how the Internet is used at the workplace. Match the applications of Internet u
    5·1 answer
  • List and the deference between MS access objects​
    8·1 answer
  • A private network that is accessible only to employees of the company that created it is called:
    11·1 answer
  • Naseer has inserted an image into his document but needs the image to appear on its own line.
    14·2 answers
  • You decide to configure ntp on the router to get time ntp server with an ip address of 172.17.8.254 which commanda should you us
    14·1 answer
  • Describe the following types of data hazards. RAW WAR WAW
    13·1 answer
  • Patronage of most Medieval musicians was supplied by the
    13·1 answer
  • Which of the following are incident priorities?
    9·1 answer
  • How many passes will it take to find the four in this list?
    15·2 answers
  • A bank wants to reject erroneous account numbers to avoid invalid input. Management of the bank was told that there is a method
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!