In a
A) Define two arrays that may be used in parallel to store the ten employee identification numbers and gross pay amounts.
B) Write a loop that uses these arrays to print each employee’s identification number and weekly gross pay.
Want to see the full answer?
Check out a sample textbook solutionChapter 7 Solutions
Starting Out with C++ from Control Structures to Objects (9th Edition)
Additional Engineering Textbook Solutions
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Digital Fundamentals (11th Edition)
Java: An Introduction to Problem Solving and Programming (8th Edition)
Starting Out with Programming Logic and Design (4th Edition)
Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
- (Electrical eng.) Write a program that stores the following resistance values in an array named resistance: 16, 27, 39, 56, and 81. Your program should also create two arrays named current and power, each capable of storing five double-precision numbers. Using a for loop nd a cin statement, have your program accept five user-input numbers in the current array when the program is run. Your program should store the product of the values of the squares of the current array and the resistance array in the power array. For example, use power[1]=resistance[1]pow(current[1],2). Your program should then display the following output (fill in the chart):arrow_forward(Electrical eng.) Write a program that specifies three one-dimensional arrays named current, resistance, and volts. Each array should be capable of holding 10 elements. Using a for loop, input values for the current and resistance arrays. The entries in the volts array should be the product of the corresponding values in the current and resistance arrays (sovolts[i]=current[i]resistance[i]). After all the data has been entered, display the following output, with the appropriate value under each column heading: CurrentResistance Voltsarrow_forward(Numerical) a. Define an array with a maximum of 20 integer values, and fill the array with numbers input from the keyboard or assigned by the program. Then write a function named split() that reads the array and places all zeros or positive numbers in an array named positive and all negative numbers in an array named negative. Finally, have your program call a function that displays the values in both the positive and negative arrays. b. Extend the program written for Exercise 6a to sort the positive and negative arrays into ascending order before they’re displayed.arrow_forward
- (Electrical eng.) Write a program that declares three one-dimensional arrays named volts, current, and resistance. Each array should be declared in main() and be capable of holding 10 double-precision numbers. The numbers to store in current are 10.62, 14.89, 13.21, 16.55, 18.62, 9.47, 6.58, 18.32, 12.15, and 3.98. The numbers to store in resistance are 4, 8.5, 6, 7.35, 9, 15.3, 3, 5.4, 2.9, and 4.8. Your program should pass these three arrays to a function named calc_volts(), which should calculate elements in the volts array as the product of the corresponding elements in the current and resistance arrays (for example ,volts[1]=current[1]resistance[1]). After calc_volts() has passed values to the volts array, the values in the array should be displayed from inside main().arrow_forwardA positive integer greater than 1 is said to be prime if it has no divisors other than 1 and itself. Write a program that asks the user to input an integer greater than 1, then display all of the prime numbers that less than or equal to the number entered. The program should work as follows: • Once the user has entered a number, the program should display an array with all of the integers from 2 up through the value entered. • The program should then use a loop to step through the array. The loop should pass each element to a method that displays the element whether it is prime number. Your result should look like, for example: Enter an integer greater than 1: 9 2, 3, 4, 5, 6, 7, 8, 9 2 is prime 3 is prime 4 is not prime 5 is prime 6 is not prime 7 is prime 8 is not prime 9 is not prime Using java programmingarrow_forwardWrite a program that displays the number of goals scored by players during the next World Cup in Brazil. • The program should prompt the user to enter the number of players they wish to display. If an invalid entry is inputNTED, the program should re-prompt for the number. • Create an array of strings to store the appropriate number of names as entered by the user • Create an array to store each players tally of goals The user is prompted to enter the name of the player and the player’s goal tally (re-prompt in case of an exception, and also if the player has a goal tally of less than zero) • These values are stored respectively into the array of names and goals for each player. • These details are then displayed on the screenarrow_forward
- Given the following, use a for loop to display the contents of the array (use cout to display):const int SIZE = 5;int numbers[] = {0, 2, 4, 6, 8};arrow_forwardQ1: Write a program that creates an array of integers size 10. And do the following- a) Ask the user to enter 10 numbers (all > 0) one by one and store them in the array. If user enters a number < 0 then program should ask user to enter the number again with a message that "Pl enter a number > 0" b)Print the smallest number c) Print the largest number d)Print the averagearrow_forwardThis program needs 3 parts Read in this attached inputFile.txt (75 50 60 80 90) from a file into your Grade array. Use a bubble sort to sort the array (Print to console each pass of the array until the array is sorted.) Write out to console the low score the high score and the average scorearrow_forward
- This program will create an array of 12 random integers (between 1-9) and remove all numbers less than or equal to another randomly generated integer (between 1-9)There are four steps to accomplish this.a. Create and fill an array of random integers between 1-9. The array must be size 12.b. Generate a random integer between 1-9.c. Write the code that will create a new array of the integers in the given array but with the numbers less than or equal to your random number removed. For example, if you randomly generated 6 and the original array contains 1 8 9 4 4 7 2 2 5 8 4 7 your new array will contain 8 9 7 8 7d. Print the original array, the number generated, and the new array.i.e. The original array contained:1 8 9 4 4 7 2 2 5 8 4 7All numbers less than or equal to 4 to be removed.The new array contains:8 9 7 5 8 7*Keep in mind that because we are dealing with random numbers, it is possible that the random number you generate for numbers to be removed from the array is less than…arrow_forwardWrite statements to do the following: a. Create an array to hold 10 double values. b. Assign the value 5.5 to the last element in the array. c. Display the sum of the first two elements. d. Write a loop that computes the sum of all elements in the array. e. Write a loop that finds the minimum element in the array. f. Randomly generate an index and display the element of this index in the array. g. Use an array initializer to create another array with the initial values 3.5, 5.5, 4.52, and 5.6.arrow_forwardAssume temperatures[] [] is an array of SIZE to hold values of price type double that has been declared and initialized. The threshold is an oracle stock price which is 10.25 declare as constant int variable type. • Create and initialize a variable count to keep track of the values in in temperatures[ ] that are greater than threshold Using a for loop, count the number of value in the array temperatures[[] that are greater than threshold and display to outputs the countarrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT