Question

Write a program that will store 7 integers (entered by the user) into an array called...

Write a program that will store 7 integers (entered by the user) into an array called list1. Next, prompt the user for 5 integers and put them into an array called list2. Now, list all of the numbers that are in BOTH lists by calling a function called inBoth and passing list1 and list2 to that function.

List 1

------

Enter an integer: 4

Enter an integer: 2

Enter an integer: 7

Enter an integer: 1

Enter an integer: 5

Enter an integer: 6

Enter an integer: 3

List 2

------

Enter an integer: 11

Enter an integer: 9

Enter an integer: 7

Enter an integer: 5

Enter an integer: 3

The numbers that are in both lists are:

3, 5, 7

NOTE: DO NOT USE GLOBAL VARIABLES!!!!!

A global variable is a variable that is defined outside of any function (including main). We don't cover them in this course because they are generally a very bad idea. So, don't do this in your projects!

0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
Write a program that will store 7 integers (entered by the user) into an array called...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • Questions Write a method that returns the union of two array lists of integers using the...

    Questions Write a method that returns the union of two array lists of integers using the following header: public static ArrayList<Integer> union(ArrayList<Integer> list1, ArrayList<Integer> list2) Write a test program that: 1. prompts the user to enter two lists, each with five integers, 2. displays their union numbers separated by exactly one space., and 3. finds the maximum number and the minimum number in the combined list. Here is a sample run of the program. Enter five integers for list1: 5...

  • Exercise 3: Work exercise 11.4, 11.12, and 11.14 into one program (to develop 3 methods for...

    Exercise 3: Work exercise 11.4, 11.12, and 11.14 into one program (to develop 3 methods for ArrayList: first method finds the maximum element in an array list; the second method computes the sum of all elements in an array list; and the third method combines (union) two lists by adding the second list to the first list). Use Integer type for all methods. See problem statements for methods signatures and sample test data. Write one separate test program to test...

  • Write a program that asks the user to input 10 integers of an array. The program...

    Write a program that asks the user to input 10 integers of an array. The program then inserts a new value at position (or index) given by the user, shifting each element right and dropping off the last element. For example, in the sample input/output below, the program will insert the value 30 at index 3. All the previous numbers of the array starting from position 3 (i.e., 7 1 20 9 23 8 22 will be shifted one position...

  • (C++) Write a function, remove, that takes three parameters: an array of integers, the number of...

    (C++) Write a function, remove, that takes three parameters: an array of integers, the number of elements in the array, and an integer (say, removeItem). The function should find and delete the first occurrence of removeItem in the array. (Note that after deleting the element, the number of elements in the array is reduced by 1.) Assume that the array is unsorted. Also, write a program to test the function. Your program should prompt the user to enter 10 digits...

  • Name : StarryArrays Write a program called StarryArrays which prompts user for the number of items...

    Name : StarryArrays Write a program called StarryArrays which prompts user for the number of items in an array (a non-nega- tive integer), and saves it in an int variable called numltems. It then prompts user for the values of all the items (non-negative integers) and saves them in an int array called items. The program shall then print the contents of the array in a graphical form, with the array index and values represented by number of stars For...

  • Write a program that asks the user to enter 1000 integers to be stored in an...

    Write a program that asks the user to enter 1000 integers to be stored in an array called "numbers". Since the same integer might occur (exist) in the array multiple times, your program needs to fill a second array, called "Isolate" that contains all the integers from the first array but NOT REPAPTED (every integer will exist only once). Finally, your program will print the integers of the second array sorted by occurrence (occurrence is: the number of times the...

  • Assembly Language////Write a program that read in 10 integers from the user. Save the numbers into...

    Assembly Language////Write a program that read in 10 integers from the user. Save the numbers into an array; reverse the array and display the reversed array. .data arrayInt DWORD 10 DUP(?) Your program consists of 4 procedures: 1. main procedure: call procedures getInput, reverseArray, displayArray 2. getInput procedure: prompt user to enter 10 integer numbers, save the numbers into the memory for the arrayInt 3. reverseArray: reverse arrayInt 4. displayArray: display the reversed array

  • JAVA - Write a function in your Main class LinkedList<E> mergeLists(LinkedList<E> list1, LinkedList<E> list2) - given...

    JAVA - Write a function in your Main class LinkedList<E> mergeLists(LinkedList<E> list1, LinkedList<E> list2) - given two ordered linked lists of integers, merge the two lists into a single LinkedList whose elements are in sorted order. You should create a new LinkedList and add the values from list1 and list2 into the new list in sorted order. Do not modify list1 or list 2. list1 => 1 -> 3 -> 7 -> 8, list2 => 2 -> 5 -> 7...

  • Declare an array of integers called ages The arra bold 119 integers Prompt and get an...

    Declare an array of integers called ages The arra bold 119 integers Prompt and get an ange from the user for the fourth element in the artay Prompt and get a score from the user for the last element in the array HTML tau nt ages(11% printf Enter a number for the fourth dlement; scan%,age30 rints Enter a number for the last element, scant, r. ages(119D 5 6 7 8 9 ERT 7 Y U O P F G HUKL

  • c++ please no global varaible write a value returning function input data to dynamically allocate a...

    c++ please no global varaible write a value returning function input data to dynamically allocate a short array of size elements and store the input data entered from the disk file into array.Return the base address of the array allocated.Read the data from the text file Hello.txt and store the data in reverse order in the array.the size of the data set will be in the file size 10 and the data was 1 2 3 4 5 6 7...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT