enum brands = { GM, FORD, TOYOTA, BMW, KIA };
const int N_BRANDS = 5;
const int COLOR_TYPES = 6;
double sales[N_BRANDS][COLOR_TYPES];
int times[30][7];
int speed[15][7];
int trees[100][7];
int students[50][7];
PROBLEM 1:
Problem 2:
42: Total elements of array sales=N_BRANDS * COLOR_TYPE = 5 * 6=30
41:Number of row in array sales = N_BRANDS= 5(In the array first box represents number of ROWS)
40:Number of column in array sales = COLOR_TYPE= 6 (In the array second box represents number of COLUMNS)
39:For find the sum of sales by BRAND Sum the data of particular row (e.g for toyota enum number is the 3 so sum the data of row 3)
38:For find the sum of sales by COLOR_TYPE Sum the data of particular COLUMN (e.g for red color number is the 3 so sum the data of column 3)
37:
int row=3,sales_of_toyota=0;
for(int column=1;column<=6;column++)
{
sales_of_toyota=sales_of_toyota+sales[3][column];
}
cout<<"Sales of toyota brand="<<sales_of_toyota;
PROBLEM 3:
41:
int times[30][7];//choice=1
int speed[15][7];//choice=2
int trees[100][7];//choice=3
int students[50][7];//choice=4
void printem(int choice1,choice2=0)//creates a default function
printem for either print 1 or 2 array element
{
switch(choice1)
{
case 1:for(int
i=0;i<30;i++)//prints array of times
{
for(int
j=0;j<7;j++)
cout<<times[i][j];
}
cout<<"\n";
break;
case 2:for(int
i=0;i<15;i++)//prints array of speed
{
for(int
j=0;j<7;j++)
cout<<speed[i][j];
}
cout<<"\n";
break;
case 3:for(int
i=0;i<100;i++)//prints array of trees
{
for(int
j=0;j<7;j++)
cout<<tree[i][j];
}
cout<<"\n";
break;
case 4:for(int
i=0;i<50;i++)//prints array of students
{
for(int
j=0;j<7;j++)
cout<<students[i][j];
}
cout<<"\n";
break;
default:cout<<" ";
break;
}
switch(choice2)
{
case 1:for(int
i=0;i<30;i++)//prints array of times
{
for(int
j=0;j<7;j++)
cout<<times[i][j];
}
cout<<"\n";
break;
case 2:for(int
i=0;i<15;i++)//prints array of speed
{
for(int
j=0;j<7;j++)
cout<<speed[i][j];
}
cout<<"\n";
break;
case 3:for(int
i=0;i<100;i++)//prints array of trees
{
for(int
j=0;j<7;j++)
cout<<tree[i][j];
}
cout<<"\n";
break;
case 4:for(int
i=0;i<50;i++)//prints array of students
{
for(int
j=0;j<7;j++)
cout<<students[i][j];
}
cout<<"\n";
break;
default:cout<<" ";
break;
}
}
-40:
int times[30][7];
int speed[15][7];
int trees[100][7];
int students[50][7];
void printem(int speed[15][7],int trees[100][7])//creates a
function printem
{
for(int i=0;i<15;i++)//prints array of speed
{
for(int j=0;j<7;j++)
cout<<speed[i][j];
}
cout<<"\n";
for(int i=0;i<100;i++)//prints array of
trees
{
for(int j=0;j<7;j++)
cout<<trees[i][j];
}
cout<<"\n";
}
(10 pts) Define a two-dimensional array named temp with three rows and four columns of type int such that the first...
Define a two-dimensional int array which has 5 rows and 3 columns. The elements in array is randomly initialized (using Math.random()). Write a method to find the maximum value in this two dimensional array; Write a method to find the average value in the array; Write a method to count how many elements are smaller than average; Write a method to copy contents in a two-dimensional array to a one-dimensional array. The method will return this one-dimensional array. Method is...
c++ 48. values is a two-dimensional array of floats with 10 rows and 20 columns. Write code that sums all the elements in the array and stores the sum in the variable total 48. values is a two-dimensional array of floats with 10 rows and 20 columns. Write code that sums all the elements in the array and stores the sum in the variable total
ASSEMBLY LANGUAGE The matrix (two-dimensional array) with ROWS and COLS dimensions of integer values is given. Perform various matrix processing activities according to the algorithms below. Store the results into the output vector (one-dimensional array) with appropriate size. For Grade 7) Count the number of odd values (n mod 2 <> 0) for each row. For Grade 9) Calculate the sum of positive values for each column. To obtain inputs and return the results, define appropriate type C/C++ functions. Please...
| ome Insert Design Layout References Mailings View Help Tell me what you want to do from the l Unless you need to edit, it's safer to stay in 11. Write C++ statements that do the following: a. Declare an array alpha of 10 rows and 20 columns of type int. b. Initialize the array alpha to 0. c. Store 1 in the first row and 2 in the remaining rows d. Store 5 in the first column, and make...
Write a C function f such that … function f accepts, as input, … a two-dimensional array of integers in which each row has three columns the number of rows in the array function f returns the sum of the odd integers in the given array of integers and returns zero if there are no odd integers in the array COMPILER STACK TRACE None PROGRAM EXECUTION STACK TRACE None COMPILER COMMAND LINE ARGUMENTS -lm INPUT OF THE TEST CASE 1 #define NUM_ROWS 5...
Use a two-dimensional array to solve the following problem. A company has four salespeople (1 to 4) who sell five different products (1 to 5). Once a day, each salesperson passes in a slip for each different type of product sold. Each slip contains the following a) The salesperson number b) The product number c) The total dollar value of that product sold that day Thus, each salesperson passes in between 0 and 5 sales slips per day. Assume that...
Concepts tested by the program: Working with one dimensional parallel arrays Use of functions Use of loops and conditional statements Description The Lo Shu Magic Square is a grid with 3 rows and 3 columns shown below. The Lo Shu Magic Square has the following properties: The grid contains the numbers 1 – 9 exactly The sum of each row, each column and each diagonal all add up to the same number. s is shown below: Write a program that...
whats the answers How many total integers elements are in an array with 4 rows and 7 columns? 07 28 11 What is the resulting array contents, assuming that itemList is an array of size 4 having contents -55, -1, 0, 9? for (i = 0; i < 4; ++i) { itemsList[i] - i; -54,0, 1, 10 O 0, 1, 2, 3 O 1, 2, 3, 4 O-55,-1, 0,9 Given an integer array myVals of size N_SIZE (i.e. int[] myVals...
Step 1. Open Excel and complete first two columns with any numbers Make 7-8 rows. Type below first column "R = " We will use Excel function CORREL(Array-1, Array-2). STEP 2. Click on cell B11 and type: =CORREL( Highlight all numbers in A-column starting with cell A2 (do not include title). That will be Array-1 (input range). Type comma after Array-1 and highlight Array-2 from B-column. Press ENTER. You will see in cell B11 Coefficient of Linear Correlation. STEP 3....
I need help as quick as possible, thanks beforehand. Please provide the test output The Lo Shu Magic Square is a grid with 3 rows and 3 columns shown below. 35 The Lo Shu Magic Square has the following properties: The grid contains the numbers 1 - 9 exactly The sum of each row, each column and each diagonal all add up to the same number. This is shown below: 15 4 92 15 - 81 + 15 15 15...