Define stubs for the functions get_user_num) and compute_avg). Each stub should print "FIXME: Finish function_name" followed by a newline, and should return -1. Each stub must also contain the function's parameters Sample output with two calls to get_user_num) and one call to compute_avg): FIXME: Finish get_user_num() FIXME: Finish get_user_num() FIXME: Finish compute_avg() Avg: -1 1 ' Your solution goes here '' 2 4 user_num1 = 0 5 user_num2 = 0 6 avg_result = 0 7 8 user_num1 = get_user_num 9 user_num2 = get_user_num ) 10 avg_result = compute_avg(user_num1, user_num2) 11 12 print'Avg:', avg_result)|

Answers

Answer 1

Answer:

Here are the stub functions get_user_num() and compute_avg()

def get_user_num():

   print('FIXME: Finish get_user_num()')

   return -1  

def compute_avg(user_num1, user_num2):

   print('FIXME: Finish compute_avg()')

   return -1

Explanation:

A stub is a small function or a piece of code which is sometimes used in program to test a function before its fully implemented. It can also be used for a longer program that is to be loaded later. It is also used for a long function or program that is remotely located. It is used to test or simulate the functionality of the program.  

The first stub for the function get_user_num() displays FIXME: Finish get_user_num() and then it returns -1.

The seconds stub for the function compute_avg() displays the FIXME: Finish compute_avg() and then it returns -1.

Here with each print statement, there is function name after this FIXME: Finish line. The first function name is get_user_num and the second is compute_avg().

Next the function get_user_num() is called twice and function compute_avg() followed by a print statement: print('Avg:', avg_result) which prints the result. So the program as a whole is given below:

def get_user_num():

   print('FIXME: Finish get_user_num()')

   return -1  

def compute_avg(user_num1, user_num2):

   print('FIXME: Finish compute_avg()')

   return -1  

user_num1 = 0  # the variables are initialized to 0

user_num2 = 0

avg_result = 0  

user_num1 = get_user_num()  #calls get_user_num method

user_num2 = get_user_num()

avg_result = compute_avg(user_num1, user_num2)  

print('Avg:', avg_result)

The method get_user_num() is called twice so the line FIXME: Finish get_user_num() is printed twice on the output screen. The method compute_avg() is called once in this statement avg_result = compute_avg(user_num1, user_num2)   so the line FIXME: Finish compute_avg() is printed once on the output screen. Next the statement print('Avg:', avg_result) displays Avg: -1. You can see in the above program that avg_result = compute_avg(user_num1, user_num2)   and compute_avg function returns -1 so Avg= -1. The program along with the produced outcome is attached.

Define Stubs For The Functions Get_user_num) And Compute_avg). Each Stub Should Print "FIXME: Finish

Related Questions

"The correct syntax for passing an array as an argument to a method when a method is called and an array is passed to it is: "

Answers

Question:

"The correct syntax for passing an array as an argument to a method when a method is called and an array is passed to it is: "

A) a[0]..a[a.length]

B) a()

C) a

D) a[]  

Answer:

The correct answer is A.

An example is given in the attachment.

Cheers!

If your computer freezes on a regular basis and you checked your hard drive and you have insufficient space you've not installed any software that could cause disruption you have recently added more around so you realize that you have enough memory and that isn't causing a problem what could you do to check next? A) Ensure that the computer is disconnected from the internet by removing any Ethernet cables. B) Use scandisk to ensure that the hard drive is not developing errors or bad sectors. C) Replace the CPU and RAM right away. D) Install additional fans to cool the motherboard.

Answers

Answer:

d

Explanation:

If your computer freezes on a regular basis, and you have enough memory and that isn't causing a problem. You should install additional fans to cool the motherboard. The correct option is D.

What is computer freezing?

Computer freezing means the computer is not running smoothly. It is causing concerns in opening any application or running software. It is also called computer hanging. The freezing can occur due to the heating of the motherboard. The addition of the fans would be good.

Freezing on the computer happens when the memories of the computer are full, or any virus has been installed on the computer. Hanging or freezing of computers can be avoided by emptying some data or installing an antivirus.

Thus, the correct option is D. Install additional fans to cool the motherboard.

To learn more about computer freezing, refer to the link:

https://brainly.com/question/15085423

#SPJ2

A script sets up user accounts and installs software for a machine. Which stage of the hardware lifecycle does this scenario belong to?

Answers

Answer:

deployment phase

Explanation:

This specific scenario belongs to the deployment phase of the hardware lifecycle. This phase is described as when the purchased hardware and software devices are deployed to the end-user, and systems implemented to define asset relationships. Meaning that everything is installed and set up for the end-user to be able to use it correctly.

Write a program that asks the user to input a positive integer and then calculates and displays the factorial of the number. The program should call a function named getN

Answers

Answer:

The program is written in python and it doesn't make use of any comment;

(See explanation section for line by line explanation)

def getN(num):

     fact = 1

     for i in range(1, 1 + num):

           fact = fact * i

     print("Factorial: ",fact)

num = int(input("Number: "))

if num < 0:

     print("Invalid")

else:

     getN(num)

Explanation:

The function getNum is defined here

def getN(num):

Initialize the result of the factorial to 1

     fact = 1

Get an iteration from 1 to the user input number

     for i in range(1, 1 + num):

Multiply each number that makes the iteration

           fact = fact * i

Print result

     print("Factorial: ",fact)

Ths line prompts user to input number

num = int(input("Number: "))

This line checks if user input is less than 0; If yes, the program prints "Invalid"

if num < 0:

     print("Invalid")

If otherwise, the program calls the getN function

else:

     getN(num)

Implement the function:

string get_ap_terms(int a, int d, size_t n);

which returns a string containing the first n terms of the arithmetic progression (AP) as a sequence of comma-separated values.

Answers

Answer:

This is written in C++

Check comments for explanations

Program starts here

#include<iostream>

#include<string>

using namespace std;

//The function get_ap_terms begins here

string get_ap_terms(int a, int d, int size_tn)

{  

// This line initializes the expected string to empty string

string result = "";

//The for iteration loops through the number of terms the function is expected to return

for(int i = 1; i<= size_tn;i++)

{

//This line checks if the loop is less than the number of  terms    

if(i < size_tn)

  {

//This string gets the current term of the progression

   result+=to_string(a)+ ", ";

//This line calculates the next term

   a+=d;  

  }

  else

  {

//This line calculates the last term

   result+=to_string(a);

  }

}

//This line returns the string containing the first n terms of the arithmetic progression

return result;

}

//The main function starts here

int main()

{

//This line declares the first term (a), the common difference (d) and the number of terms (size_tn)

int a,d,size_tn;

//This line prompts the user for the first term

cout<<"First Term: ";

//This line gets the first term

cin>>a;

//This line prompts the user for the common difference

cout<<"Common Difference: ";

//This line gets the common difference

cin>>d;

//This line prompts the user for number of terms

cout<<"Number of Terms: ";

//This line gets the number of terms

cin>>size_tn;

//This line calls the function to print the string containing the first n terms

cout<<get_ap_terms(a, d, size_tn);

return 0;

}

//Program ends here

DOLLAR GENERAL
x
Knowledge Check
Non-employees are allowed in the store before the store opens and after
closing time.
True
False
SUBMIT​

Answers

Answer:

False

Explanation:

Unless authorized by a manager. Only staff members are allowed in the store before and after normal store hours.

Answer:

The correct answer is

False

If you are not an employee you are not allowed in stores before opening hours or after closing time. The only times non-staff are allowed in the store is for purchasing of products during hours of operation.h

Hope this helps!

If you have taken any drugs, it's not safe to drive.
A. True
B. False

Answers

Answer:

True

Explanation:

It is risky to drive while you are on drugs!

Other Questions
Front wheel drive vehicles typically use To eliminate the terms and solve for y in the fewest steps, by which constants should the equations be multiplied by before adding the equations together? First equation: 9x + 3y = -18 Second equation: 8x + 7y = 10 Determine the domain and range for the function.f (x) = x + 7 How would I Evaluate 8510? After turning into a bug, what newfound obstacle does Gregor Samsa face in chapter 1 of The Metamorphosis What is the solution of 3+ x-2/x-3 Please answer this correctly The altitude at which we boil an egg affects how long it takes for the egg to achieve perfect hardness. It takes 198198198 seconds to boil a perfect egg at the lowest place possible, the edge of the Dead Sea, which has an altitude of -418418minus, 418 meters. The highest place possible is the summit of Mount Everest which has an altitude of 884888488848 meters. It takes 209209209 seconds to boil a perfect egg there. T(a)T(a)T, left parenthesis, a, right parenthesis models the time (in seconds) it takes to boil a perfect egg at an altitude of aaa meters. Which number type is more appropriate for the domain of TTT? If you were to experimentally determine the length of the pendulum, why would you not get the same length in Iowa? Do dog sweat? If yes, can you explain? Working out simultaneous equations. What was a result of the mexican-american war someone help asap math 10 The state tax Patrick must pay on the initial profit is . The federal tax he must pay on the initial profit is . The inflation on the amount remaining after taxes is . As a result, the real value of Patricks profit is Joplin called his pieces _______ ______ in an attempt to make them sound more refined than other ragtime pieces. When a strip of magnesium metal is placed in an aqueous solution of copper(II) nitrate, elemental copper coats the surface of the magnesium strip and aqueous magnesium nitrate forms. 1. As a reactant, what is the charge on copper? 2. As a product, what is the charge on copper? Can someone help me please Underline the dependent clause in each compound-complex sentence. Tania raked the leaves since Mason mowed the lawn; together, they made the lawn look awesome. I need help with this please KELLY ConnectDeidra RobertsCONTACT CENTER OUTSOURCINGSupervisor: "You are currently scheduled to work Monday through Friday of nextweek. I need you to try to assist 9 more customers per day to hit your goal for theweek."Employee: "That seems very realistic. I currently assist an average of 52 customersper day, so the total number of customers l assist per week would be295300304305