The function retrieveAt of the class arrayListType is written as a void function. Rewrite this function so that it is written as a value returning function, returning the required item. If the location of the item to be returned is out of range, use the assert function to terminate the program. Also, write a program to test your function. Use the class unorderedArrayListType to test your function.

Answers

Answer 1

Answer:

int retrieveAt(int location, array){

   // Function to retrieve the element from the list at the position

   // specified by the location

   if (location <= array.size() - 1){

       return array[location];

   } else{

       cout<<"Location out of range";

       assert(); // Assuming the assert function is defined in the program.

   }

}

Explanation:

The void retrieveAt function is converted to a return function that returns the integer item of the array given the location and the array variable as arguments. The assert function is used to terminate the program.


Related Questions

What is digital transformation?

Answers

Answer:Digital Transformation is the adoption of digital technology to transform services or businesses, through replacing non-digital or manual processes with digital processes or replacing older digital technology with newer digital technology

Explanation:

Answer:

Explanation:

Digital transformation is the process of using digital technologies to transform existing traditional and non-digital business processes and services, or creating new ones, to meet with the evolving market and customer expectations, thus completely altering the way businesses are managed and operated, and how value is delivered to customers

which of the following is correct statement ? A
. a set of instructions is called program
B.computers can be used for diagnosing the difficulty of a student in learning a subject . C. psychological testing can be done with the help of computer provided software is available. D. all of the above

Answers

Answer:

D all of the above

Explanation:

because a computer performs all the above_mentioned tasks

All of the above options are  correct statement. Check more about program below.

What is program?

A program is regarded as some set of compositions of instructions or codes that a computer needs to follows so as to carry out a specific work.

Conclusively, the correct statement are:

A set of instructions is called program,Computers can be used for diagnosing the difficulty of a student in learning a subject. Psychological testing can be done with the help of computer provided software is available.

Learn more about program from

https://brainly.com/question/1538272

In C++
Write a simple program to test your Circle class. The program must call every member function at least once. The program can do anything of your choice.

Answers

Answer:

int main() {

   Circle* pCircle = new Circle(5.0f, 2, 3);

   pCircle->up();

   pCircle->down();

   pCircle->left();

   pCircle->right();

   cout << "X: " << pCircle->getx() << endl;

   cout << "Y: " << pCircle->gety() << endl;

   cout << "Radius: " << pCircle->getRadius() << endl;

   pCircle->print();

   pCircle->update_radius(4.0f);

   if (pCircle->isUnit()) {

       cout << "is unit" << endl;

   }

   pCircle->move_x(10);

   pCircle->move_y(10);

}

Explanation:

something like that?

Which field would best function as a primary key for a table that tracks orders?
OrderDate
CustomerType
OrderID
CustomerID

Answers

Answer:

Order ID

Explanation:

An order ID is a new ID for every order. Every number is unique, making it the beat way to find certain orders.

Answer:

C

Explanation:

Computer programming 2

Answers

Here is the second photo

Which three of the following statements are true about using a WYSIWYG editor?

1.You can preview the web page you’re creating, but it might appear very differently in a web browser.
2.After creating a web page, you need to inspect the code the editor generates for correctness.
3.You can write your own HTML code to create a web page.
4.You can modify the HTML code the editor generates.
5.You don’t need any knowledge of HTML to be able to create a web page.

Answers

Answer:

3

Explanation:

Answer:

The answer is

You can write your own HTML code to create a web page.You can modify the HTML code the editor generates.You don’t need any knowledge of HTML to be able to create a web page.

Explanation:

Plato 5/5

Write out code for a nested if statement that allows a user to enter in a product name, store the product into a variable called product_name and checks to see if that product exists in your nested if statement. You must include 5 product names to search for. If it is then assign the price of the item to a variable called amount and then print the product name and the cost of the product to the console. If it does not find any of the items in the nested if statement, then print that item cannot be found.

Answers

Answer:

product_name = input("Enter product name : ")

if product_name=="pen"or"book"or"box"or"pencil"or"eraser":

   if product_name == "pen":  

       amount = 10

       print(f"Product Name: {product_name}\nCost: {amount} rupees")

   if product_name == "book":

       amount = 100

       print(f"Product Name: {product_name}\nCost: {amount} rupees")

   if product_name == "box":  

       amount = 150

       print(f"Product Name: {product_name}\nCost: {amount} rupees")

   if product_name == "pencil":  

       amount = 5

       print(f"Product Name: {product_name}\nCost: {amount} rupees")

   if product_name == "eraser":

       amount = 8

       print(f"Product Name: {product_name}\nCost: {amount} rupees")

else:  

   print("Item not found!")

Explanation:

The python program is a code of nested if-statements that compares the input string to five items of the first if-statement. For every item found, its code block is executed.

what is a case in programming​

Answers

Answer:

A case in programming is some type of selection, that control mechanics used to execute programs :3

Explanation:

:3

Computer programming 3

Answers

The first photo of output i still need 2 posts

discuss advantages and disadvantages of os

Answers

Answer:

Advantages :

Management of hardware and software

easy to use with GUI

Convenient and easy to use different applications on the system.

Disadvantages:

They are expensive to buy

There can be technical issues which can ruin the task

Data can be lost if not saved properly

Explanation:

Operating system is a software which manages the computer. It efficiently manages the timelines and data stored on it is considered as safe by placing passwords. There are various advantages and disadvantages of the system. It is dependent on the user how he uses the software.

Write a program named Averages that includes a method named Average that accepts any number of numeric parameters, displays them, and displays their average. For example, if 7 and 4 were passed to the method, the output would be: 7 4 -- Average is 5.5 Test your function in your Main(). Tests will be run against Average() to determine that it works correctly when passed one, two, or three numbers, or an array of numbers. Grading When you have completed your program, click the Submit button to record your score.

Answers

Answer:

In Java:

import java.util.*;

public class Averages{

public static double Average(int [] myarr, int n){

    double sum = 0;

    for(int i = 0;i<n;i++){

        System.out.print(myarr[i]+" ");

        sum+=myarr[i];     }

    System.out.println();

    return sum/n; }

public static void main(String[] args) {

  Scanner inp = new Scanner(System.in);

  System.out.print("Length of inputs: ");

  int n = inp.nextInt();

  int [] arr = new int[n];

  System.out.print("Enter inputs: ");

  for(int i = 0; i<n;i++){

      arr[i] = inp.nextInt();   }

  System.out.println("Average: "+Average(arr,n)); }}

Explanation:

The function is defined here

public static double Average(int [] myarr, int n){

Initialize sum to 0

    double sum = 0;

Iterate through the elements of the array

    for(int i = 0;i<n;i++){

Print each element followed by space

        System.out.print(myarr[i]+" ");

Add up elemente of the array

        sum+=myarr[i];     }

Print a new line

    System.out.println();

Return the average

    return sum/n; }

The main begins here

public static void main(String[] args) {

  Scanner inp = new Scanner(System.in);

Prompt the user for number of inputs

  System.out.print("Length of inputs: ");

Get the number of inputs

  int n = inp.nextInt();

Declare an array

  int [] arr = new int[n];

Get element of the array

  System.out.print("Enter inputs: ");

  for(int i = 0; i<n;i++){

      arr[i] = inp.nextInt();   }

Call the Average function

  System.out.println("Average: "+Average(arr,n)); }}

Write a program that will input temperatures for consecutive days. The program will store these values into an array and call a function that will return the average of the temperatures. It will also call a function that will return the highest temperature and a function that will return the lowest temperature. The user will input the number of temperatures to be read. There will be no more than 50 temperatures. Use typedef to declare the array type. The average should be displayed to two decimal places

Answers

Answer:

#include <iostream>  

using namespace std;

typedef double* temperatures;

double avg(array t, int length);

double min(array t, int length);

double max(array t, int length);

int main()

{

   cout << "Please input the number of temperatures to be read." << endl;

   int num;

   cin >> num;

   temperatures = new double[num];

   for(int i = 0; i < num; i++)

   {

       cout << "Input temperature " << (i+1) << ":" << endl;

       cin >> temperatures[i];

   }

   cout << "The average temperature is " << avg(temperatures, num) << endl;

   cout << "The highest temperature is " << max(temperatures, num) << endl;

   cout << "The lowest temperature is " << min(temperatures, num) << endl;

}

double avg(array t, int length)

{

   double sum = 0.0;

   for(int i = 0; i < length; i++)

       sum += t[i];

   return sum/length;

}

double min(array t, int length)

{

   if(length == 0)

       return 0;

    double min = t[0];

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

       if(t[i] < min)

           min = t[i];

   return min;

}

double max(array t, int length)

{

   if(length == 0)

       return 0;

      double max = t[0];

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

       if(t[i] > min)

           max = t[i];

   return max;

}

Explanation:

The C++ program get the array of temperatures not more than 50 items and displays the mean, minimum and maximum values of the temperature array.

Write a program that will input miles traveled and hours spent in travel. The program will determine miles per hour. This calculation must be done in a function other than main; however, main will print the calculation. The function will thus have 3 parameters: miles, hours, and milesPerHour. Which parameter(s) are pass by value and which are passed by reference

Answers

def calculations(miles, hours):
milesPerHour = miles / hours
return milesPerHour

def main():
miles = input("Enter Miles driven: ")
hours = input("Enter Travel Hours: ")
print(calculations(miles, hours))

if __name__=='__main__':
main()

Define a function below, count_over_100, which takes a list of numbers as an argument. Complete the function to count how many of the numbers in the list are greater than 100. The recommended approach for this: (1) create a variable to hold the current count and initialize it to zero, (2) use a for loop to process each element of the list, adding one to your current count if it fits the criteria, (3) return the count at the end.

Answers

Answer:

In Python:

def count_over_100(mylist):

   kount = 0

   for i in range(len(mylist)):

       if mylist[i] > 100:

           kount+=1

   return kount

Explanation:

This defines the function

def count_over_100(mylist):

(1) This initializes kount to 0

   kount = 0

(2) This iterates through the loop

   for i in range(len(mylist)):

If current list element is greater tha 100, kount is incremented by 1

       if mylist[i] > 100:

           kount+=1

This returns kount

   return kount

An early attempt to force users to use less predictable passwords involved computer-supplied passwords. The passwords were eight characters long and were taken from the character set consisting of lowercase letters and digits. They were generated by a pseudorandom number generator with 215possible starting values. Using technology of the time, the time required to search through all character strings of length 8 from a 36-character alphabet was 112 years. Unfortunately, this is not a true reflection of the actual security of the system. Explain the problem.

Answers

Answer:

Recently, with the new and advanced hacking algorithms and affordable high-performance computers available to adversaries, the 36 character computer suggested passwords can easily be insecure.

Explanation:

The 8 length passwords generated pseudo-randomly by computers are not secure as there are new algorithms like the brute force algorithm that can dynamically obtain the passwords by looping through the password length and comparing all 36 characters to get the right one.

And also, the use of high-performance computers makes these algorithms effective

identify the following​

Answers

Answer:

attachment sign

Explanation:

that is the attachment sign.

Help asap dont answer with a link​

Answers

Answer:

90

Explanation:

dur nearly all my friends and family knows that

Scenario
Your task is to prepare a simple code able to evaluate the end time of a period of time, given as a number of minutes (it could be arbitrarily large). The start time is given as a pair of hours (0..23) and minutes (0..59). The result has to be printed to the console.
For example, if an event starts at 12:17 and lasts 59 minutes, it will end at 13:16.
Don't worry about any imperfections in your code - it's okay if it accepts an invalid time - the most important thing is that the code produce valid results for valid input data.
Test your code carefully. Hint: using the % operator may be the key to success.
Test Data
Sample input:
12
17
59
Expected output: 13:16
Sample input:
23
58
642
Expected output: 10:40
Sample input:
0
1
2939
Expected output: 1:0

Answers

Answer:

In Python:

hh = int(input("Start Hour: "))

mm = int(input("Start Minute: "))

add_min = int(input("Additional Minute: "))

endhh = hh + (add_min // 60)  

endmm = mm + (add_min % 60)

endhh += endmm // 60

endmm = endmm % 60

endhh = endhh % 24  

print('{}:{}'.format(endhh, endmm))

Explanation:

This prompts the user for start hour

hh = int(input("Start Hour: "))

This prompts the user for start minute

mm = int(input("Start Minute: "))

This prompts the user for additional minute

add_min = int(input("Additional Minute: "))

The following sequence of instruction calculates the end time and end minute

endhh = hh + (add_min // 60)  

endmm = mm + (add_min % 60)

endhh += endmm // 60

endmm = endmm % 60

endhh = endhh % 24  

This prints the expected output

print('{}:{}'.format(endhh, endmm))

Which of the following cannot be used in MS Office.
Joystick
Scanner
Light Pen
Mouse

Answers

Answer:

A.

Explanation:

A Joystick is a control device that is connected to the computer to play games. A joystick is similar in structure to a control stick used by pilots in airplanes and got its name from the same. A joystick contains a stick, base, extra buttons, auto switch fire, trigger, throttle, POV hat, and a suction cup. A joystick also serves the purpose of assistive technology.

The device which can not be used in MS Office is a joystick. Therefore, option A is correct.

How are BGP neighbor relationships formed?
1-Automatically through BGP
2-Automatically through EIGRP
3-Automatically through OSPF
4-They are setup manually

Answers

Answer:

4-They are setup manually

Explanation:

BGP neighbor relationships formed "They are set up manually."

This is evident in the fact that BGP creates a nearby adjacency with other BGP routers, this BGP neighbor is then configured manually using TCP port 179 for the actual connection, which is then followed up through the exchange of any routing information.

For BGP neighbors relationship to form it passes through different stages, which are:

1. Idle

2. Connect

3. Active

4. OpenSent

5. OpenConfirm

6. Established

Select all the sets that are countably infinite. Question 3 options: the set of real numbers between 0.1 and 0.2 the set of all negative integers greater than negative 1 trillion the set of integers whose absolute values are greater than 1 billion the set of integers that are multiples of 27 the set of all java and C programs

Answers

Answer:

1.  the set of real numbers between 0.1 and 0.2

2. the set of all negative integers greater than negative 1 trillion

3.  the set of all java and C programs

Explanation:

A set is countable if it is either finite or has the same cardinality as the set of positive integers. The inverse of this set type is uncountable.

The set of real numbers between 0.1 and 0.2, all negative integers greater than negative 1 billion, and a set of java and C programs are all countable sets, so are considered countably infinite.

The sets that should be considered as the countably infinite.

1.  the set of real numbers between 0.1 and 0.2

2. the set of all negative integers greater than negative 1 trillion

3.  the set of all java and C programs

What is set?

The set should be considered as the countable in the case when it could be either finite or contain a similar kind of cardinality just like the positive integers set. The inverse of this type of set should be considered as the non-countable. The set of the real numbers should be lies between the 0.1 and 0.2, all negative integers should be more than negative 1 billion, the st of java and c program should be considered as the countable sets

Learn more about set here: https://brainly.com/question/17506968

Which are the two alternatives for pasting copied data in a target cell or a group of cells?
You can right-click the target cell or cells and then select the ___
option or press the ___
keys to paste the copied data.

Answers

Answer:

first blank: paste

2nd blank: ctrl + v

Explanation:

those ways are just how you do it anywhere.

reasons why you should add green computing:

Answers

Answer:

Green Computing aims to reduce the carbon footprint generated by the information systems business while allowing them to save money. Today there is a great need to implement the concept of Green computing to save our environment. About 60-70 percent energy ON and that consumed energy is the main reason of co2 emission

Explanation:

Hope it helps!

If you dont mind can you please mark me as brainlest?

If name is a String instance variable, average is a double instance variable, and numOfStudents is a static int variable, why won’t the following code from a class compile?public Student(String s) {name = s;average = getAverage(name);numOfStudents++;}public double getAverage(String x) {numOfStudents++;double ave = StudentDB.getAverage(x);return ave;}public static void setAverage(double g) {average = g;}a.The setAverage() method can’t access the average instance variable.b.The getAverage() method can’t increment the numOfStudents variable.c.The constructor can’t increment the numOfStudents variable.d.The getAverage() method can’t call a static method in the StudentDB class.

Answers

Answer:

a.

Explanation:

Based solely on the snippet of code provided on the question the main reason why the code won't compile (from the options provided) is that the setAverage() method can’t access the average instance variable. Since the average variable is an instance variable it means that it only exists inside the one of the functions and not to the entire class. Meaning that in this scenario it can only be accessed by the Student function and once that function finishes it no longer exists. Also, it is not one of the options but if these variables are instance variables as mentioned their type needs to be defined inside the function.

what does the
command do

Answers

Please specify your question.




Suspicious activity, like IP addresses or ports being scanned sequentially, is a sign of which type of attack?

Answers

Answer: It depends, but it is definitely a networking attack.

Explanation:

After scanning for vulnerable ports, I could go in a number of different directions. I could initiate a DOS attack by flooding a vulnerable port with requests. I could also initiate a Man-in-the-Middle attack by intercepting their network traffic (usually through port 80(HTTP) if it's not encryped). Because of this, it is highly recommended to use a VPN, so hackers have a harder time getting your data

1) primary storage is stored externally (true or false)

2) one function of storage is to store program and data for later use(true or false)
correct answer only i will mark u as brainliest and i will give u 5 star rating if ur answer will correct​

Answers

Answer:

1.true

2.true

Ok will wait my rate ok❤️

Can you please provide sample rexx code?

Answers

Answer:

/*  My first REXX program  */

say 'Hello world'

Explanation:

REXX is an OS/2 scripting language.

describe the major elements and issues with agile development​

Answers

Answer:

water

Explanation:

progresses through overtime

discuss advantages and disadvantages of operating system

Answers

Answer and Explanation:

Advantages-

Computing source- Through the operating system, users can communicate with computers to perform various functions such as arithmetic calculations and other significant tasks.Safeguard Of Data- There’s a lot of user data stored on the computer. Windows Defender in Microsoft Windows detects malicious and harmful files and removes them. Also, it secures your data by storing them with a bit to bit encryption.Resource Sharing- Operating systems allow the sharing of data and useful information with other users via Printers, Modems, Players, and Fax Machines. Besides, a single user can share the same data with multiple users at the corresponding time via mails. Also, various apps, images, and media files can be transferred from PC to other devices with the help of an operating system.

Disadvantages-

Expensive- It is costly.System Failure- System failures may occur. If the central operating system fails, it will affect the whole system, and the computer will not work. If the central system crashes, the whole communication will be halted, and there will be no further processing of data.Virus Threats- Threats to the operating systems are higher as they are open to such virus attacks. Many users download malicious software packages on their system which halts the functioning of OS and slow it down.

Answer:

Advantages ) -

1) They have different and unique properties .

2) They function differently and have great experience .

3) They allow us to progress through the life of technology .

Disadvantages ) -

1) Many softwares and programs not function on every OS and we have to use different external and/or 3rd party programs .

2) They have different level and speed of emulations .

Other Questions
Something fun to do...Would you like to make a song with me? It might song a bit better if you use similes or metaphors, for example ( Metaphor ) I like to fly, I'm a swan! Or ( Simile ) You sure look just like one. 2) Solve the system of equations using substitution.2x 9y = 14x= -6y +7 Which word Im the sentence helps the reader determine the meaning of the word perplexity here's another math question for y'all A math test is worth 50 points, but there is extra credit. If you get 110% on the test, how many points is your score? PLEASE HELP WITH THESE !!ILL TRY TO MARK BRAINLIEST !! The building blocks of proteins are called? Help me please PLEASEEEEE A right is unenumerated if it is What comes from Alaska for cars? A.steel B.gold C.oil. D.iron Please help as soon as possible John Adams was an extremely well liked president.TrueFalse arrange the words in cline solid, rough,firm,hard, concrete You were at a pool when something interesting happened 22Choose word group below that is an independent clause or is not an independent clause.is Frankfort the capital of Kentucky?a. an independent clauseb. not an independent clause. 5 things you eat that contains corn,soy,rice,or potato's Read the case and answer the questions that follow. Maura Goodwin was accused of stealing money from the offices petty cash drawer over a two-year period. At her trial, the prosecuting attorney proved that Goodwin had access to the petty cash, and she had worked there during the time the money was taken. The prosecution did not have any witnesses or information that showed only Goodwin could have taken the money. Goodwins attorney proved that other people had access to the petty cash and that these people also worked in the office during the time that the money was taken. Should Goodwin be found guilty of stealing the money? Why or why not? 1) Which person's claims was MOSTLY backed up with evidence and research? Parker Henderson B) Macy Washington Jose Mack D) Svetlana Gorbachevski A.The Murray family has produced 8 children. What is the probability that there are an equal number of boys and girls? B.Margie has the uncanny ability of being able to guess the correct answer to TRUE/FALSE questions with an 80% accuracy rate. Tomorrows test has 7 questions on it and she needs to answer 5 questions correctly in order to make the Honor Roll. If she guesses on every question, what is the probability that shell answer exactly 5 questions correctly? What are gametes? How are gametes different from regular body (somatic) cells?