Programming & Computer Science Answers

C++ 9913
Python 5288
Java | JSP | JSF 3611
C 1680
C# 1362
Computer Networks 989
Algorithms 652
Databases | SQL | Oracle | MS Access 641
HTML/JavaScript Web Application 588
Other 537
Visual Basic 358
Assembler 209
Software Engineering 202
AJAX | JavaScript | HTML | PHP 166
MatLAB 150
MatLAB | Mathematica | MathCAD | Maple 124
Action Script | Flash | Flex | ColdFusion 112
UNIX/Linux Programming 89
Web Development 73
Excel 36
ASP | ASP.NET 23
Delphi | Pascal 21
Perl 16
Prolog 9
Functional Programming 9
MathCAD 5
Wolfram Mathematica 4
WPF 4
Ruby | Ruby on Rails 3
NodeJS Web Application 2

Questions answered by Experts: 26 876

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search

Declare an array called annualSalary and populate it using the values given above.

 Declare an array called monSalary and populate it using default values.

 Display all the contents in the annual salary array.

 Increment the annual salary for all the employees who earn less than R100 000 by adding R10 000 

for each employee in this category, and then count how many employees who got an increase.

 Calculate the monthly salary and display both the new annual salary as well as the monthly salary.

 Calculate and display the average salary.

 Find and display the highest annual salary.





College ABC has recruited new employees that they pay a certain annual salary as given below.


Table 1.1 Annual Salary in Rands R150 000 R250 000 R650 000 R99 000 R68 000 R35 000 R95 000 R28 000

Monthly Salary (R) 0 0 0 0 0 0 0 0



Write a C++ program called Salaries.cpp for the college’s salary administration, the program must do the following:

 Declare an array called annualSalary and populate it using the values given above.

 Declare an array called monSalary and populate it using default values.

 Display all the contents in the annual salary array.

 Increment the annual salary for all the employees who earn less than R100 000 by adding R10 000 for each employee in this category, and then count how many employees who got an increase.

 Calculate the monthly salary and display both the new annual salary as well as the monthly salary.

 Calculate and display the average salary.

 Find and display the highest annual salary






College ABC has recruited new employees that they pay a certain annual salary as given below. Table 1.1 Annual Salary in Rands R150 000 R250 000 R650 000 R99 000 R68 000 R35 000 R95 000 R28 000  Write a C++ program called Salaries.cpp for the college’s salary administration, the program must do the following:  Declare an array called annualSalary and populate it using the values given above.  Declare an array called monSalary and populate it using default values.  Display all the contents in the annual salary array.  Increment the annual salary for all the employees who earn less than R100 000 by adding R10 000 for each employee in this category, and then count how many employees who got an increase.  Calculate the monthly salary and display both the new annual salary as well as the monthly salary.  Calculate and display the average salary.  Find and display the highest annual salary. 


Prefix Suffix

Write a program to check the overlapping of one string's suffix with the prefix of another string.Input


The first line of the input will contain a string A.

The second line of the input will contain a string B.Output


The output should contain overlapping word if present else print "No overlapping".Explanation


For example, if the given two strings, A and B, are "ramisgood" "goodforall"

The output should be "good" as good overlaps as a suffix of the first string and prefix of next.

Sample Input 1

ramisgood

goodforall

Sample Output 1

good

Sample Input 2

finally

restforall

Sample Output 2

No overlapping


Trying:
    overlap('ramisgood', 'goodforall')
Expecting:
    'good'
ok
Trying:
    overlap('final', 'final')
Expecting:
    'final'
ok
Trying:
    overlap('toast', 'tst')
Expecting:
    't'
ok
Trying:
    overlap('', '')
Expecting:
    'No overlapping'
ok
Trying:
    overlap('first', '')
Expecting:
    'No overlapping'
ok
Trying:
    overlap('', 'second')
Expecting:
    'No overlapping'
ok
1 items had no tests:
    __main__
1 items passed all tests:
   6 tests in __main__.overlap
6 tests in 2 items.
6 passed and 0 failed.
Test passed.

Expected:

good

Expected: output 2:

No overlapping

You are given a square matrix A of dimensions NxN. You need to apply the below given 3 operations on the matrix A.


Rotation: It is represented as R S where S is an integer in {90, 180, 270, 360, 450, ...} which denotes the number of degrees to rotate. You need to rotate the matrix A by angle S in the clockwise direction. The angle of rotation(S) will always be in multiples of 90 degrees.


Update: It is represented as U X Y Z. In initial matrix A (as given in input), you need to update the element at row index X and column index Y with value Z.

After the update, all the previous rotation operations have to be applied to the updated initial matrix.


Querying: It is represented as Q K L. You need to print the value at row index K and column index L of the matrix A. Input


The first line contains a single integer N.

Next N lines contain N space-separated integers Aij (i - index of the row, j - index of the column).

Next lines contain various operations on the array. Each operation on each line (Beginning either with R, U or Q).

-1 will represent the end of input.Output


For each Query operation print the element present at row index K and colum index L of the matrix in its current state.Explanation


For Input:

2

1 2

3 4

R 90

Q 0 0

Q 0 1

R 90

Q 0 0

U 0 0 6

Q 1 1

-1


Initial Matrix

1 2

3 4


For R 90, clockwise rotation by 90 degrees, the matrix will become

3 1

4 2


For Q 0 0, print the element at row index 0 and column index 0 of A, which is 3.

For Q 0 1, print the element at row index 0 and column index 1 of A, which is 1.


Again for R 90, clockwise rotation by 90 degrees, the matrix will become

4 3

2 1


For Q 0 0, print the element at row index 0 and column index 0 of A, which is 4.


For U 0 0 6, update the value at row index 0 and column index 1 in the initial matrix to 6. So the updated matrix will be,

6 2

3 4

After updating, we need to rotate the matrix by sum of all rotation angles applied till now(i.e. R 90 and R 90 => 90 + 90 => 180 degrees in clockwise direction).

After rotation the matrix will now become

4 3

2 6


Next for Q 1 1, print the element at row index 1 and column index 1 of A, which is 6.

output

3

1

4

6

11

46



Errors/Warnings:

Traceback (most recent call last):

 File "main.py", line 46, in <module>

  query(matrix, args)

 File "main.py", line 23, in query

  i, j = map(int, _args)

ValueError: too many values to unpack (expected 2)

output:

11

46

23



JavaScript

Split and Replace

Given three strings

inputString, separator and replaceString as inputs. Write a JS program to split the

inputString with the given separator and replace strings in the resultant array with the replaceString whose length is greater than 7.

Quick Tip

  • You can use the string method split()
  • You can use the array method map()

Input

  • The first line of input contains a string inputString
  • The second line of input contains a string separator
  • The third line of input contains a string replaceString

Output

  • The output should be a single line containing the strings separated by a space

Sample Input 1

JavaScript-is-amazing

-

Programming


Sample Output 1

Programming is amazing


Sample Input 2

The&Lion&King

&

Tiger


Sample Output 2

The Lion King




You are given a square matrix A of dimensions NxN. You need to apply the below given 3 operations on the matrix A.


Rotation: It is represented as R S where S is an integer in {90, 180, 270, 360, 450, ...} which denotes the number of degrees to rotate. You need to rotate the matrix A by angle S in the clockwise direction. The angle of rotation(S) will always be in multiples of 90 degrees.


Update: It is represented as U X Y Z. In initial matrix A (as given in input), you need to update the element at row index X and column index Y with value Z.

After the update, all the previous rotation operations have to be applied to the updated initial matrix.


Querying: It is represented as Q K L. You need to print the value at row index K and column index L of the matrix A. Input


The first line contains a single integer N.

Next N lines contain N space-separated integers Aij (i - index of the row, j - index of the column).

Next lines contain various operations on the array. Each operation on each line (Beginning either with R, U or Q).

-1 will represent the end of input.Output


For each Query operation print the element present at row index K and colum index L of the matrix in its current state.Explanation


For Input:

2

1 2

3 4

R 90

Q 0 0

Q 0 1

R 90

Q 0 0

U 0 0 6

Q 1 1

-1


Initial Matrix

1 2

3 4


For R 90, clockwise rotation by 90 degrees, the matrix will become

3 1

4 2


For Q 0 0, print the element at row index 0 and column index 0 of A, which is 3.

For Q 0 1, print the element at row index 0 and column index 1 of A, which is 1.


Again for R 90, clockwise rotation by 90 degrees, the matrix will become

4 3

2 1


For Q 0 0, print the element at row index 0 and column index 0 of A, which is 4.


For U 0 0 6, update the value at row index 0 and column index 1 in the initial matrix to 6. So the updated matrix will be,

6 2

3 4

After updating, we need to rotate the matrix by sum of all rotation angles applied till now(i.e. R 90 and R 90 => 90 + 90 => 180 degrees in clockwise direction).

After rotation the matrix will now become

4 3

2 6


Next for Q 1 1, print the element at row index 1 and column index 1 of A, which is 6.

output

3

1

4

6

11

46



Errors/Warnings:

Traceback (most recent call last):

 File "main.py", line 46, in <module>

  query(matrix, args)

 File "main.py", line 23, in query

  i, j = map(int, _args)

ValueError: too many values to unpack (expected 2)

output:

11

46

23



College ABC has recruited new employees that they pay a certain annual salary as given below.

Table 1.1

Annual Salary. Monthly salary (R)

in Rands

R150 000. 0

R250 000. 0

R650 000. 0

R99 000. 0

R68 000. 0

R35 000. 0

R95 000. 0

R28 000. 0

Write a C++ program called Salaries.cpp for the college’s salary administration, the program must do the 

following:

 Declare an array called annualSalary and populate it using the values given above.

 Declare an array called monSalary and populate it using default values.

 Display all the contents in the annual salary array.

 Increment the annual salary for all the employees who earn less than R100 000 by adding R10 000 

for each employee in this category, and then count how many employees who got an increase.

 Calculate the monthly salary and display both the new annual salary as well as the monthly salary.

 Calculate and display the average salary.

 Find and display the highest annual salary.


Write a C++ function to show all the INNOVATORS using one dimensional an•ay. An item value which is store in array is Innovator if it is greater than all the items to its left side. And the left most item is always an Innovator. For example, in the array {11, 21, 19, 33, 79, 41}, Innovator are 79,

21 and 11.


Write a C++ function to show all the INNOVATORS using one dimensional an•ay. An item value which is store in array is Innovator if it is greater than all the items to its left side. And the left most item is always an Innovator. For example, in the array {11, 21, 19, 33, 79, 41}, Innovator are 79,

21 and 11.


LATEST TUTORIALS
APPROVED BY CLIENTS