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
Furkat [3]
4 years ago
11

Write a function named get_my_age that returns your age as an int (this is YOUR age, so if you were 21 you would return the numb

er 21). Note that this function takes no arguments and no input from the user. Call the function once and print the result. Reflect on the difference between creating a variable with a constant value and creating a function with no arguments that returns a constant return value.
Computers and Technology
1 answer:
d1i1m1o1n [39]4 years ago
5 0

Answer:

<em>The programming language is not stated; However, I'll answer this question using 2 programming languages (Python and C++)</em>

<em></em>

<em>Comments are used for explanatory purpose </em>

Python program starts here

def get_my_age():  #Declare function

      age = 21  #Assign value to age

      print(age)  #Print age

get_my_age() #Call function

#End of Program

C++ Programming Language starts here

#include<iostream>

using namespace std;

int get_my_age() //Declare Function

{

int age = 21; //Assign value to age

cout<<age; //Print age

}

int main()

{

get_my_age(); //Call Function

return 0;

}

You might be interested in
__________ are the first line of defense against unsafe drivers.
vova2212 [387]
Peace officers are the first line of defense against unsafe drivers. These officers are appointed for a specific purpose of upholding law and order, so they would be the ones who are there to help you in case of an accident caused by unsafe drivers. A peace officers is just another term for a law enforcement officer, or just the police.
5 0
3 years ago
What are the two types of formulas in excel
klasskru [66]

Hi Lisa


Complex and simple


I hope that's help :)

5 0
3 years ago
Tony is in charge of all presentations for a Fortune 500 pharmaceutical company. In addition to creating powerful and persuasive
Ludmilka [50]

Tony uses the Document Inspector dialog box to <u>remove confidential company information</u> from the presentation.

Explanation:

Document Inspector dialogue box has come as boon to the presentation and office document makers. This saves them from any discrepancies’ regarding revealing any sensitive information, unwanted information, hidden data’s etc.

These information’s if released can be a matter of concern for the employee as well as an organisation. Document inspector prevents an employee from later embarrassment and any legal troubles arising out of his actions.

Hence, Tony who is in charge of Fortune 500 pharma company decided to use Document Inspector dialogue box to make sure that his presentation his complete in all aspects of professionalism and is bereft of any sensitive and unwarranted information.  

5 0
3 years ago
Every character is represented by a code. The ASCII code for upper letter A is 65 and for lower a is 97. Similarly the numeric c
Anni [7]
True! And also quick fact there’s another thing that has thousands of codes for different languages as well. Also emojis are represented as codes
8 0
4 years ago
Help with some questions. Thank you!
Oksana_A [137]

Answer:

1. E: II and III only

2. A: (int)(Math.random() * (upper − lower) ) + lower

3. A: The value of answer is N

4. E: while( !(userGuess == secretNumber) && numGuesses <= 15 )

5. C: 21

Explanation:

1. Which of the following is equivalent to while(userGuess != secretNumber)?

I. while( userGuess < secretNumber && userGuess > secretNumber)  

NO - This will test until the userGuess is smaller AND greater than the secretNumber, at the same time... so that condition will never be true.

II. while( userGuess < secretNumber || userGuess > secretNumber)

YES - This will test the value of userGuess and see if it's smaller OR greater than secetNumber.  So, it will loop until the user guesses right.

III. while( !(userGuess == secretNumber) )

YES, this will negate the match with the secretNumber.  In order words, if it's not a match, it will return true... so the loop will run until it finds a false condition (a match).

As you can see, only II and III are valid.

2.  If the lower limit were inclusive and the upper limit exclusive, which expression would properly generate values for the secret number?

A: (int)(Math.random() * (upper − lower) ) + lower

Since the lower limit is INCLUSIVE, we mustn't add one to the lower limit.  Also, the Math.random() function returns a value that matches our needs; it returns a value between [0,1[ (meaning the 0 is included, but not the 1).

Assuming the (int) caster does return only the integer portion doing a round down of the result, we'll be perfect.

3. What conclusion can be made about the state of the program when the while loop terminates?

while(!answer.equals( "N"))

{.....

A: The value of answer is N

The condition in the loops reads as "While the negation of the answer being 'N', loop".  If the answer equals 'N' then the method should return true... which will be negated by the '!' operator, causing the condition to be false. Thus we know that if the loop ends, the value of answer contains 'N', any other value will keep the loop going.

4. Assuming numGuesses is initialized to 1, how would the while statement be modified to include an extra criterion limiting the number of guesses to 15?

E: while( !(userGuess == secretNumber) && numGuesses <= 15 )

This modified condition will first test to see if the user has guessed the secretNumber (if he has, the first sub-parenthesis will be true... so the left side of the && operator will be false due to the negation operator.  The right side of the && operator will check to see how many tries have been attempted. Since the counter starts at 1, it needs to go up to 15 inclusively... so the <= is the right comparison operator.

5. After execution of the following code segment, what will be displayed?

int x = 1;

while(x < 18)

{

x += 5;

}

System.out.println(x);

C: 21

The x variable is initialized with 1... then enters the loop, in which it is incremented by 5 at each passage.

So after first passage, x = 6

After second passage, x = 11

After third passage, x = 16

After fourth passage, x = 21

Cannot enter the loop again because 21 > 18.

So, it will print out the value of 21.

3 0
3 years ago
Other questions:
  • Which is the quickest way to change the font color in multiple, randomly located cells in a worksheet
    8·2 answers
  • To arrange data in alphabetical order quickly, you can _____ the data.
    7·2 answers
  • The maximum number of colors that should be used on a slide is _____. 2 4 6 8
    5·1 answer
  • A properYour customer has connected a 1000-watt microwave oven and a 600-watt mixer to a 15-amp branch service line for the kitc
    11·2 answers
  • PowerPoint allows you to input files from variety of sources, such as Microsoft access.
    6·1 answer
  • Windows 1.0 was not considered to be a "true" operating system but rather an operating environment because _____.
    13·1 answer
  • What protocol communicates data between routers representing the edges of autonomous systems?Distance-vectorLink stateInterior g
    11·1 answer
  • Which tab on the Chart Tools Contextual tab will contain commands that are used to change the style of charts and to edit chart
    12·2 answers
  • Someone plz answer
    8·1 answer
  • What dose a company’s code of ethics cover
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!