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
Dmitriy789 [7]
3 years ago
10

Write a method named square that accepts an integer argument and returns the square of that argument.

Computers and Technology
1 answer:
BaLLatris [955]3 years ago
7 0

Answer:

The method is as follows:

double square(int num){

return num*num;

}

Explanation:

Written in C++

This first line defines the method

double square(int num){

This line returns the square of num

return num*num;

}

<em>I've added the full program as an attachment where I include the main method</em>

Download cpp
You might be interested in
In order to prevent unauthorized access, how can the shadow file be configured to enforce a password policy?​ What happens to ac
NemiM [27]

Answer : The securtiy of the password can be maitained by the shadow files such as:-

  • max is for the days that represent that the same password can be used without the need for changing it  
  • min is for the days that represent waiting days before the changing of password after he/she gets a new password
  • warn are the days that come with Waring sign that the password is going to expire soon.

For a certain period of time , the user can access the log in when the password has expired . If that period is timed out then there will be no log in option and the account gets disabled.

4 0
2 years ago
A program is expressed in a programming language. Whiat is true of the program?
zalisa [80]

Answer:

The answer is "The program can also be expressed as a binary code, but it is easier for people to understand when it is expressed in a higher programming language".

Explanation:

In the given question some details are missing that is options of the question that can be given as follows:

A. The program can also be expressed as a binary code, but it is easier for people to understand when it is expressed in a higher programming language.  

B. The program can also be represented as a binary code that reduces the likelihood of errors.  

C. Binary code can not be used for binary code, because binary code can only represent data.  

D. Some parts of the program, however, should be printed in a higher-level language for the operation.  

The computer knows the only binary language, It is a form of 0 and 1, but this language can't be understood by the user. It will convert into high-level language, that is understood by the user, that's why this option is correct.  In which accepts of option A, all options are wrong that can be described as follows:

  • In option B, It is wrong, because the user may not understand binary language, and he can also be writing some wrong code that is converted in binary code, that will increase error.
  • In option C and option D, is incorrect because all the data that is stored in the computer is in the form of binary code.

4 0
2 years ago
Will somebody help me???? ANYBODY?? PLZZZZZZZZZZZZ
romanna [79]
I've never seen that third syntax. If it's legit, it probably does the same as I and II, which are the same.
6 0
3 years ago
In unreal engines which class should be used to define the rules of the game
mel-nik [20]

Answer: The number of players and spectators present, as well as the maximum number of players and spectators allowed.

Explanation: players

8 0
3 years ago
A small grocery store has one checkout.You have been asked to write a program to simulate the grocery store as it checks out cus
Masteriza [31]

Answer:

Check the explanation

Explanation:

PYTHON CODE :

#import random function

from random import randint

#class Queue declaration

class Queue:

#declare methods in the Queue

def __init__(self):

self. items = []

def isEmpty(self):

return self. items == []

def enqueue(self, item):

self.items. insert(0, item)

def dequeue(self):

return self. items. pop()

def size(self):

return len(self. items)

def getInnerList(self):

return self.items

#This is customer Queue

class Customer:

#declare methods

def __init__(self,n):

self.numberOfItems=n

def __str__(self):

return str(self. numberOfItems)

def getNumberOfItems(self):

return self. numberOfItems

#This is expresscheker customer queue

class Expresschecker:

def __init__(self,n):

self.numberOfItems=n

def __str__(self):

return str(self. numberOfItems)

def getNumberOfItems(self):

return self. numberOfItems

#Returns random checkout time, based on number of items

def checkOut(Expresschecker):

items = Expresschecker. getNumberOfItems()

if items <= 10:

return randint(2, 5)

if items <= 20:

return randint(6, 9)

return randint(10, 14)

#Initiate queue for the Expresschecker

Expresschecker = Queue()

#declare total customers

totalcheckoutCustomers = 10

#express Customers shopping..

for i in range(totalcheckoutCustomers):

#Each putting Between 1 to 25 items

randomItemsQty = randint(1, 25)

customer = Customer(randomItemsQty)

#Getting into queue for checkout

Expresschecker. enqueue(customer)

#====Now all express Customers having

#random qty of items are in Queue======

#intial time

totalTime=0

#define the size of the queue

totalcheckoutCustomers = Expresschecker. size()

#using for-loop until queue is empty check out

#the items in the express cheker queue

while not(Expresschecker. isEmpty()):

totalTime+=randint(1,5)

#Picking a customer

expresscustomer = Expresschecker. dequeue()

#Processing the customer

timeTaken = checkOut(expresscustomer)

#add the time for each custimer

totalTime+=timeTaken

#compute average waiting time

averageWaitingTime = totalTime/totalcheckoutCustomers

#display the average waiting time

print("Average waiting time for the express customer queue is "

+str(averageWaitingTime)+" minutes ")

print("Remaining Custimers in the express customer Queue is: ",

Expresschecker. size())

#Returns random checkout time, based on number of items

def checkOut(customer):

items = customer. getNumberOfItems()

if items <= 10:

return randint(1, 5)

if items <= 20:

return randint(6, 10)

return randint(11, 15)

#in

customersQueue = Queue()

totalCustomers = 20 #Change number of customers here

#Customers shopping..

for i in range(totalCustomers):

#Each putting Between 1 to 25 items

randomItemsQty = randint(1, 25)

customer = Customer(randomItemsQty)

#Getting into queue for checkout

customersQueue. enqueue(customer)

#====Now all Customers having random qty

#of items are in Queue======

totalTime=0

totalCustomers = customersQueue. size()

while not(customersQueue. isEmpty()):

totalTime+=randint(1,5)

#Picking a customer

customer = customersQueue. dequeue()

#Processing the customer

timeTaken = checkOut(customer)

totalTime+=timeTaken

#Result=============================

averageWaitTime = totalTime/totalCustomers

print("Average wait time for the customer queue is

"+str(averageWaitTime)+" minutes ")

print("Remaining Customers in the customer Queue is:

",customersQueue. size())

5 0
3 years ago
Other questions:
  • The ______ identifies the path for the currently open folder
    8·2 answers
  • In Microsoft Windows, which of the following typically happens by default when a file is "double-clicked"
    10·2 answers
  • If we collect data on the number of wins each team in the NFL had during the 2011-12 season, we have _____________ data.
    10·1 answer
  • Extend to also calculate and output the number of 1 gallon cans needed to paint the wal. Hint: Use a math function to round up t
    12·1 answer
  • Which key should you press and hold to select multiple cells?
    8·2 answers
  • Assume you are given a boolean variable named isNegative and a 2-dimensional array of ints that has been created and assigned to
    8·1 answer
  • Can Algorithms Be Used Again?
    8·1 answer
  • Arrange these steps of creating a presentation in the correct order. (notice that the given order is incorrect other than the ba
    13·1 answer
  • Which part of the computer is responsible for managing memory allocation for all applications
    12·1 answer
  • Write algorithm and flowchart for the following<br>a.find the sum and average of any four numbers ​
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!