Consider the following declarations: const int CAR_TYPES = 5; const int COLOR_TYPES = 6; double sales[CAR_TYPES][COLOR_TYPES]; a. How many components does the array sales have? b. What is the number of rows in the array sales? c. What is the number of columns in the array sales? d. To sum the sales by CAR_TYPES, what kind of processing is required? e. To sum the sales by COLOR_TYPES, what kind of processing is required?
Q: Write a function that accepts (but does not read) a 2D array of marks and length (the number of…
A: The function is provided in the next step.
Q: Consider the following declaration: (1, 2) double currentBalance[91]; The array name b. The…
A: a.The array name is currentBalanceb. The array size is 92c. The data type of each array component is…
Q: 1) Suppose you have the following array declaration: int test[13]; Assuming that a variable of…
A: Note - As per the guidelines we are only allowed to answer 1 question with three sub parts at a…
Q: store information about a house, take input from user regarding information about rooms, kitchen,…
A: House class The program comprise of a class House having data members as rooms, kitchens,…
Q: maximum value that can be represented in a single element of the array
A: According to the question we need to find what is the maximum value that can be represented in a…
Q: Define a “Invalidanalyze” function that accepts an array of “Course” objects. It will return the…
A: Answer: You didn't mention programming language So I did this program using java. Java Source Code:…
Q: Determine whether the following array declarations are valid. If a declaration is valid, write…
A: note:“Since you have posted a question with multiple sub-parts, we will solve first three subparts…
Q: Which of the following statements is true? m.length has the value 6. m[0].length has the…
A: int[][] m=new int[5][6]; Now, m is a two-dimensional array with 5 rows and 6 columns
Q: Write a code that calculates the total score for students in a class. Suppose the scores are stored…
A: CODE TO COPY public class TotalScore { /** main method **/ public static void main(String[]…
Q: Given the following array definition: int values[] = {2, 6, 10, 14};what do each of the following…
A: Given:- int values[] = {2, 6, 10, 14}; i.e a[0]=2 a[1]=6 a[2]=10 a[3]=14
Q: Mr. Ahmed wants to create a database of employees in his company with three records for each…
A: Hi. Let's move on to the code in the next step. I have included comments in the code that will…
Q: (B) Write a Java program that crates an array of 150 random uppercase letters, and then converts a…
A: In Java, Math.random() is used to return a pseudorandom double type number greater than or equal to…
Q: declare an array, what will all of the array’s elements have in common?
A: declare an array, all of the array’s elements have in common
Q: the parameter passing mechanism for an array is call by value or call by reference?
A: Parameter passing mechanism for an array is call by value. This mechanism is used for passing…
Q: 1. Write a program that stores dynamically allocated array of Movie (using calloc() function). Movie…
A: Actually, program is a executable software that runs on a computer.
Q: 17. 2D Array Operations Write a program that creates a tw
A: Write a program that creates a two-dimensional array initialized with test data. Use any primitive…
Q: What happens to the contents of an array when the array's reference variable is re-assigned by an…
A: I have given an answer in step 2.
Q: For an array declartion of int number [25];, what will be the ending index? 0 1 24…
A: Elements of an array is stored in contiguous memory location. Indexing of an array starts from 0.
Q: Your task is to design Dynamic Array (Class). What is Dynamic Array? Which can grow and shrink at…
A: The ask is to explain/do the following: a) What is a Dynamic Array? b) Create a dynamic array of…
Q: Given the following array definition and code snippet what is the following code doing? int MaxC =…
A: The questions were asked to find the output of the program. ZZ
Q: in java create a two-dimensional array of type double to contain the three different SD Marks…
A: In a 2D(2 dimensional) array, there are rows and columns resembling a grid. If there are 3 module…
Q: Determine whether the following array declarations are valid. If a declaration is valid, write…
A: 1. int x, y; char[][] board = new board[x][y]; INVALID correct declaration int x, y; char[][] board…
Q: f J[2][1] in the following array declaration? int[][] J= {{5, 10 }, {15, 20, 25}, {30, 35}}; a. 20
A: What is the value of J[2][1] in the following array declaration? int[][] J= {{5, 10 }, {15, 20, 25},…
Q: an int variable k, an int array currentMembers that has been declared and initialized, an int…
A: Given: an int variable k, an int array currentMembers that has been declared and initialized, an…
Q: Question 3 Write Java program that defines a double array of size 3, inputs 3 values in the array,…
A: Code: import java.util.Scanner;public class Main{ public static void main(String[] args) {…
Q: а. Write a declaration for the array below and name it matrix. -1 7 1 1 2 -1 -1 4 1 6 b. Given the…
A: a) For a 2-Dimensional integer array, initialization can be done by putting values in curly braces…
Q: b. double [] a2 = new {2.5}: c. double [] a4 = {5, 2}: d. double [] a3 = new {5.1.2.8}: 2. Which of…
A: Lets see the solution.
Q: Problem: We need a program that takes 8 products and makes calculations and informs the user.…
A: - We need to highlight the code for the cost, maximum and minimum expensive item.
Q: you are required to store information about a house, take input from user regarding information…
A: House class: The program comprises of a class House having data members as rooms, kitchens,…
Q: Problem: We need a program that takes 8 products and makes calculations and informs the user.…
A: I have written code in C++. According to the question we have to write a program that takes the…
Q: QUESTION 2: Class Rectangle has two data members, length (type of float) and width (type of float).…
A: The correct option is option B. arrayRectangle[1].setLength(4.15);…
Q: int[] test = new int[-10]; %3D
A: In programming languages, an array declaration cannot be negative. An Array is a combination of…
Q: Java code: declare an array of type Animal and create an array for this variable which can hold 5…
A: Program: public class Main { public static void main(String[] args) { String[] Animals =…
Q: Write the method sum2D() which accepts a two dimensional integer array and returns the sum of all…
A: Note- since programming language is not specified we are providing solution in python programming.…
Q: Determine whether the following array declarations are valid. If a declaration is valid, write…
A: An array is a collection of similar elements. An array can be of type integer, float, double, or…
Q: b. In the main method, The program reads from the user the number of branches in the company. The…
A: Step 1 : Start Step 2 : Create a method getBranchSalariesSum to compute the Maximum salary given by…
Q: (ii) Declare an array, studentScore, and initialize its components to 98.5, 75.5, 36.5, 88.5 and…
A: // As programming language is not mentioned, we are providing answer in C++ language.…
Q: JAVA Create a class called 'Matrix' containing constructor that initializes the number of rows…
A: A class “Mat” for Matrix is created containing constructor which initializes the no of rows and…
Q: can you please write this in java.util.scanner form and can you make it so i can copy and past it,…
A: The UML Class for the given functionality is as below:
Q: The following function checks whether the dataset stored in an array follows the rules of a…
A: Solution:- Please find below your answer in second step;
Q: In C# Use a one-dimensional array to solve the following problem. Write a class called ScoreFinder.…
A: Find the code attached.
Q: Your task is to create a function that simulates a vending machine. Given an amount of money (in…
A: function vendingMachine(products, money, number) { let coins = [500,200,100,50,20,10], result =…
Q: Question 5 What is the type declaration for an integer array called iArray with 5 elements?
A: Array An array is a set of items that are stored in contiguous memory locations. The idea is to…
Q: Write a function that accepts (but does not read) a 2D array of marks and length (the number of…
A: Find solutions for your homework Search home / study / engineering / computer…
Q: ) Why should programmers always use a defined constant in an array declaration?
A: Note: According to organizations' guidelines we are allowed to answer the first question. Kindly…
Q: Problem 1: Write an equals method for the Car class. Two cars are equal if they have the same model…
A: public boolean equals(Car c) { if(this.model.equals(c.model) && this.color.equals(c.color))…
Q: Write a function that accepts (but does not read) a 2D array of marks and length (the number of…
A: Solution: Implementation of void TotalAverage(const double marks[][NUM_ASG], int length, double…
Q: Determine whether the following array declarations are valid. If a declaration is valid, write…
A: This declaration is valid.
Consider the following declarations:
const int CAR_TYPES = 5;
const int COLOR_TYPES = 6;
double sales[CAR_TYPES][COLOR_TYPES];
a. How many components does the array sales have?
b. What is the number of rows in the array sales?
c. What is the number of columns in the array sales?
d. To sum the sales by CAR_TYPES, what kind of processing is required?
e. To sum the sales by COLOR_TYPES, what kind of processing is required?
Trending now
This is a popular solution!
Step by step
Solved in 5 steps
- Code an exam in Java that repeatedly asks the user to enter the capital for a province in Canada. Then, the program should report whether the answer is correct. Eventually, you must display how many answers the user guessed correctly.The requirements are as follows: - Use a 2D array to hold the provinces and their capitals (as implied by the table below)- Answers are not case-sensitive (e.g. Toronto and tOrOnto are considered the same)The bank will store a record for each account consisting of a customer number (an integer) representing the owner of the account, an account type (a single char: C for chequing, S for savings, and M for mutual fund), and the balance of the account (a double). These are kept in three arrays-an array of customer numbers, an array of types, and an array of balances. A sample of what this might look like appears below: Customer Array 102241 992944 992944 Type Array C S C Balance Array 1.29 22.50 1.24 The entries in the array correspond to one another-for example, the first slot in all three arrays represent the fact that customer number 102241 has a chequing account with $1.29 in it. As is shown, the same customer number can appear several times, as customers can have more than one account. These are called parallel arrays, because the slots in each correspond, and the really important thing about parallel arrays is that if you shuffle around anything in one array, you have to…The bank will store a record for each account consisting of a customer number (an integer) representing the owner of the account, an account type (a single char: C for chequing, S for savings, and M for mutual fund), and the balance of the account (a double). These are kept in three arrays-an array of customer numbers, an array of types, and an array of balances. A sample of what this might look like appears below: Customer Array 102241 992944 992944 Type Array C S C Balance Array 1.29 22.50 1.24 The entries in the array correspond to one another-for example, the first slot in all three arrays represent the fact that customer number 102241 has a chequing account with $1.29 in it. As is shown, the same customer number can appear several times, as customers can have more than one account. These are called parallel arrays, because the slots in each correspond, and the really important thing about parallel arrays is that if you shuffle around anything in one array, you have to…
- 1)Examine the above code that creates the array: a)How is the base type of the array specified? b)How is the length of the array specified? c)How many Strings are actually stored in the array after the array has been created? d)How is the base type of the ArrayList specified? e)How is the capacity of the ArrayList specified? f)What is the capacity of the ArrayList? g)What is the size of the ArrayList?What is the value of J[2][1] in the following array declaration? int[][] J= {{5, 10 }, {15, 20, 25}, {30, 35}}; a. 20 b. 30 c. 35 d. 15Given the following array declaration: int myArray[10]={1,2,3,4,5,6,7,8,9,10}; How would you reference the 3 in the array?
- Write a program in C++ that simulates a lottery. The program should have an array of five integers named winningDigits, with a randomly generated number in the range of 0 through 9 for each element in the array. The program should ask the user to enter five digits and should store them in a second integer array named player. The program must compare the corresponding elements in the two arrays and count how many digits match. For example, the following shows the winningDigits array and the Player array with sample numbers stored in each. There are two matching digits, elements 2 and 4. WinningDigits 7 4 9 1 3 player 4 2 9 7 3 Once the user has entered a set of numbers, the program should display the winning digits and the player’s digits and tell how many digits matched.In C++, create a class for a 3-dimensional array. To make it more general, allow the actual dimensionality to be 0d, 1d, 2d, or 3d. It should support indexing with operator(). If the programmer subscripts with fewer indices than you 'need' (0 for a 1d, 0 or 1 for a 2d, 0 or 1 or 2 for a 3d -- note that you can't under-subscript a 0d array), you should return the appropriately sized sub-array (of your class's type). (Note: This will require multiple overloads of operator() with different numbers of index arguments.) Since, as a template, math operations don't make sense, you'll have to for-go addition, etc. But you could use + and += for concatenation. Basically aligning the common dimensions of the two arrays and concatenating along the remaining dimension. (There can be only one for this to make sense. If there are none remaining, there are options for those kinds of things!) Make sure to overload it for proper dimensionality: Of course, you should also support input (the programmer…a) create a method that accepts a 2D array and shuffles it values (like playing cards) b) test your method from main: print your 2D array before and after c) create a similar method that will return the array. Call and test it from main .
- JAVA Create a class called 'Matrix' containing constructor that initializes the number of rows and number of columns of a new Matrix object. The Matrix class has the following information: 1 - number of rows of matrix 2 - number of columns of matrix 3 - elements of matrix in the form of 2D array The Matrix class has methods for each of the following: 1 - get the number of rows 2 - get the number of columns 3 - set the elements of the matrix at given position (i,j) 4 - adding two matrices. If the matrices are not addable, "Matrices cannot be added" will be displayed. 5 - multiplying the two matricesJAVA PROGRAM Chapter 7. PC #16. 2D Array Operations Write a program that creates a two-dimensional array initialized with test data. Use any primitive data type that you wish. The program should have the following methods: • getTotal. This method should accept a two-dimensional array as its argument and return the total of all the values in the array. • getAverage. This method should accept a two-dimensional array as its argument and return the average of all the values in the array. • getRowTotal. This method should accept a two-dimensional array as its first argument and an integer as its second argument. The second argument should be the subscript of a row in the array. The method should return the total of the values in the specified row. • getColumnTotal. This method should accept a two-dimensional array as its first argument and an integer as its second argument. The second argument should be the subscript of a column in the array. The method should return the…Write your own array library named “my_array_library.h” with two-dimensional arrayincluding the following functions and create a project and test these functions with“main.c”.- Enter the elements of an array- Print the elements of an array- Print the mth, nth element of an array