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
yulyashka [42]
2 years ago
10

Given a member function named set_age() with a parameter named age in a class named Employee, what code would you use within the

function to set the value of the corresponding data member if the data member has the same name as the parameter
Computers and Technology
1 answer:
BaLLatris [955]2 years ago
6 0

Answer:

Explanation:

This would be considered a setter method. In most languages the parameter of the setter method is the same as the variable that we are passing the value to. Therefore, within the function you need to call the instance variable and make it equal to the parameter being passed. It seems that from the function name this is being written in python. Therefore, the following python code will show you an example of the Employee class and the set_age() method.

class Employee:

   age = 0

   

   def __init__(self):

       pass

   

   def set_age(self, age):

       self.age = age

As you can see in the above code the instance age variable is targeted using the self keyword in Python and is passed the parameter age to the instance variable.        

You might be interested in
What features are offered by most of the email programs with for receiving and sending messages?
Varvara68 [4.7K]

Answer:

The main features of email is, (1) Attachment :Ability to attach the files along the messages is one of most useful features of email. (2)Address book: It is also most important features of email that allows a user to storing the information.

Explanation:

3 0
2 years ago
Within the sites that support disaster recovery, __________ is a separate facility that does not have any computer equipment but
inna [77]

Question:

Within the sites that support disaster recovery, __________ is a separate facility that does not have any computer equipment but is a place where employees can move after a disaster.

A) disaster site

B) hot site

C) warm site

D) cold site

Answer:

The correct answer is answer is D)                  

Explanation:

A cold site is a business location that is utilised as a  backup in the event of a disruptive operational disaster at the normal business site. A cold site is an office, but it does not always have the necessary equipment to resume prompt operations. The business paying for the cold site, provides and installs this equipment.

Cheers!

6 0
3 years ago
Consider the code fragment below (with nested loops). int sum = 0;for (int i = 1; i < 5; i++) for (int j = 1; j <= i; j++)
sammy [17]

Answer:

Option d is the correct answer for the above question.

Explanation:

  • The first loop of the program has a second loop and then the statement. In this scenario, the second loop executes for the value of the first loop and the statement executes for the value of the second loop.
  • The first loop executes 4 times, Then the second loop or inner loop executes n times for the n iteration of the first loop, for example, 1 time for the first iteration of the first loop, 2 times for the second iteration of the first loop and so on.
  • Then the inner loop executes (1+2+3+4) iteration which gives the result 10 iterations.
  • The sum initial value is 0 and the "sum++", increase the value of the sum by 1.
  • So the value of the sum becomes 10 after completing 10 iterations of the inner for loop.
  • Hence the 10 will be the output. So the Option d is the correct answer while the other is not.
3 0
3 years ago
a cryptarithm is a mathematical puzzle where the goal is to find the correspondence between letters and digits such that the giv
Leokris [45]

Using the knowledge in computational language in C++ it is possible to write a code that  cryptarithm is a mathematical puzzle where the goal is to find the correspondence between letters and digits

<h3>Writting the code:</h3>

<em>#include <bits/stdc++.h></em>

<em>using namespace std;</em>

<em>// chracter to digit mapping, and the inverse</em>

<em>// (if you want better performance: use array instead of unordered_map)</em>

<em>unordered_map<char, int> c2i;</em>

<em>unordered_map<int, char> i2c;</em>

<em>int ans = 0;</em>

<em>// limit: length of result</em>

<em>int limit = 0;</em>

<em>// digit: index of digit in a word, widx: index of a word in word list, sum: summation of all word[digit]  </em>

<em>bool helper(vector<string>& words, string& result, int digit, int widx, int sum) { </em>

<em>    if (digit == limit) {</em>

<em>        ans += (sum == 0);</em>

<em>        return sum == 0;</em>

<em>    }</em>

<em>    // if summation at digit position complete, validate it with result[digit].</em>

<em>    if (widx == words.size()) {</em>

<em>        if (c2i.count(result[digit]) == 0 && i2c.count(sum%10) == 0) {</em>

<em>            if (sum%10 == 0 && digit+1 == limit) // Avoid leading zero in result</em>

<em>                return false;</em>

<em>            c2i[result[digit]] = sum % 10;</em>

<em>            i2c[sum%10] = result[digit];</em>

<em>            bool tmp = helper(words, result, digit+1, 0, sum/10);</em>

<em>            c2i.erase(result[digit]);</em>

<em>            i2c.erase(sum%10);</em>

<em>            ans += tmp;</em>

<em>            return tmp;</em>

<em>        } else if (c2i.count(result[digit]) && c2i[result[digit]] == sum % 10){</em>

<em>            if (digit + 1 == limit && 0 == c2i[result[digit]]) {</em>

<em>                return false;</em>

<em>            }</em>

<em>            return helper(words, result, digit+1, 0, sum/10);</em>

<em>        } else {</em>

<em>            return false;</em>

<em>        }</em>

<em>    }</em>

<em>    // if word[widx] length less than digit, ignore and go to next word</em>

<em>    if (digit >= words[widx].length()) {</em>

<em>        return helper(words, result, digit, widx+1, sum);</em>

<em>    }</em>

<em>    // if word[widx][digit] already mapped to a value</em>

<em>    if (c2i.count(words[widx][digit])) {</em>

<em>        if (digit+1 == words[widx].length() && words[widx].length() > 1 && c2i[words[widx][digit]] == 0) </em>

<em>            return false;</em>

<em>        return helper(words, result, digit, widx+1, sum+c2i[words[widx][digit]]);</em>

<em>    }</em>

<em>    // if word[widx][digit] not mapped to a value yet</em>

<em>    for (int i = 0; i < 10; i++) {</em>

<em>        if (digit+1 == words[widx].length() && i == 0 && words[widx].length() > 1) continue;</em>

<em>        if (i2c.count(i)) continue;</em>

<em>        c2i[words[widx][digit]] = i;</em>

<em>        i2c[i] = words[widx][digit];</em>

<em>        bool tmp = helper(words, result, digit, widx+1, sum+i);</em>

<em>        c2i.erase(words[widx][digit]);</em>

<em>        i2c.erase(i);</em>

<em>    }</em>

<em>    return false;</em>

<em>}</em>

<em>void isSolvable(vector<string>& words, string result) {</em>

<em>    limit = result.length();</em>

<em>    for (auto &w: words) </em>

<em>        if (w.length() > limit) </em>

<em>            return;</em>

<em>    for (auto&w:words) </em>

<em>        reverse(w.begin(), w.end());</em>

<em>    reverse(result.begin(), result.end());</em>

<em>    int aa = helper(words, result, 0, 0, 0);</em>

<em>}</em>

<em />

<em>int main()</em>

<em>{</em>

<em>    ans = 0;</em>

<em>    vector<string> words={"GREEN" , "BLUE"} ;</em>

<em>    string result = "BLACK";</em>

<em>    isSolvable(words, result);</em>

<em>    cout << ans << "\n";</em>

<em>    return 0;</em>

<em>}</em>

See more about C++ code at brainly.com/question/19705654

#SPJ1

3 0
1 year ago
Write a program that checks whether a positive number given by an input from the user is greater than 5 and less than 20 with ja
Alona [7]

Answer:

Program written in Java is as follows

See comments for explanations

import java.util.Scanner;

public class CheckRange {

public static void main (String [] args)

{

// This line allows the program accept user input

Scanner input = new Scanner(System.in);

//This line declares variable for user input

int num;

//This line prompts user for input

System.out.print("Number: ");

//This line gets user input

num = input.nextInt();

/* The following if statement checks if the user input is greater than 5 and less than 20 */

if (num > 5 && num <= 20)

{

/* This line is executed if the above condition is true */

System.out.print(num+" is greater than 5 and less than 20");

}

else

{

/*If the condition is not true, this line is executed*/

System.out.print(num+" is not within specified range");

}

// The if condition ends here

}

}

5 0
3 years ago
Other questions:
  • Which one of these tasks best describes the process of localization?
    12·1 answer
  • What protects original and creative expression of an idea?
    6·2 answers
  • You send a report to your boss for feedback and she returns it to you with her edits noted in the electronic file. This Word fea
    11·1 answer
  • Test if a number grade is an A (greater than or equal to 90). If so, print "Great!". Sample Run Enter a Number: 98 Sample Output
    7·1 answer
  • I WILL GIVE BRAINLIEST TO WHO ANSWERS FIRST AND CORRECTLY.
    6·2 answers
  • After separating from Mexico, Texas passed laws that made it harder for slave owners to _____________ slaves.
    12·2 answers
  • URGENT HELPP<br> WILL MARK BRAINLIST
    6·1 answer
  • Which user interface part shows graphical output of mined data?
    8·2 answers
  • When using MakeCode Arcade, what is the easiest way to make modules?
    6·1 answer
  • What is the difference between the wiring configurations for a residential, 8-position, 8-contact (8P8C) modular plug and jack i
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!