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

Given a MxN matrix,write a program to print all Anti-Diagonals elements of matrix

Input

The first line of input will contain a M, N values separated by space.

The second line will contain matrix A of dimensions MxN.

Output

The output should contain anti-diagonal elements separated by a line.

Explanation

For example, if M = 4, N = 4

Matrix A:



4 4

1 2 3 4

5 6 7 8

9 10 11 12

13 14 15 16


So the output should be


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.


You are given the temperature T of an object in one of Celsius, Fahrenheit, and Kelvin scales.

Write a program to print T in all scales viz Celsius, Fahrenheit, and Kelvin.

Formula to convert from Fahrenheit F to Celsius C is C = (F - 32) * 5 / 9.

Formula to convert from Kelvin K to Celsius C is C = K - 273.

Here "C", "F", "K" represent that the temperature scale is in Celsius, Fahrenheit and Kelvin scales respectively.

The input contains the temperature (a number) and the unit of the temperature scale (C, F, K) without any space.

The output contains temperature in Celsius, Fahrenheit and Kelvin scales in each line in the format similar to input and the value of the temperature is rounded to 2 decimal places.Input


The first line of the input contain a temperature Value in one of Celsius, Fahrenheit, and Kelvin scales.Output


The first line of output should contain the Celsius value and the unit of the Celsius without any space.

The second line of output should contain the Fahrenheit value and the unit of the Fahrenheit without any space.

The third line of output should contain the Kelvin value and the unit of the Kelvin without any space.Explanation


For example, if the given temperature Value is 25C then Celsius value is 25.0C, Fahrenheit value is 77.0F, and Kelvin value is 298.0K.


Write a program to print the sum of non-primes in the given N numbers. The numbers which are not primes are considered as non-primes.Input


The first line of input will contain a positive integer (N).

The following N lines will contain an integer in each line.Output


The output should be the sum of non-primes in the given numbers.Explanation


For example, if the given number is 5, then read the inputs in the next 5 lines and print the sum of non-primes in the given five numbers. If the given input integers in the next five lines are 8, 11, 96, 49, and 25 the output should be 8 + 96 + 49 + 25 is 178.


Just post is a new courier service company which services all provinces in the South Africa. They charge 

their customers based on the weight of the parcel as indicated in the table below. However, if kilograms 

are above 50, the cost is charged according to the number of hours it took to deliver. Although the time 

is entered in minutes but they are charged R95.00 per hour. Clients may also add some extras to the 

delivery such as insurance which is charged 8.5% and priority is charged at 5% of the charge.


Distance Weight Cost (R)

Local Under 5 kg R125.00

Local 5 kg up to 20 kg R175.00

Local Over 20 Kg R250.00

Long Under 5 kg R390.00

Long 5 kg up to 20 kg R450.00

Write a program that will assist with calculating the postage amount.

2.1 Create a C++ source file called Postage and save it in a file called Postage.cpp. 

2.2 Create the following functions: 

 

Functions:

Function Description Marks

2.2.1 enterPostageDetails() This function will receive five parameters that will consists of 

the minutes, the weight of a parcel, the distance, a status 

indicate if the parcel is a priority and if it will be insured.

The function will then prompt the user for the following as 

indicated in Figure 2.1 and Figure 2.2:

 the minutes, 

 the weight of a parcel, the distance, 

 priority (Y/y Or N/n) and an insurance indication (Y/y

Or N/n

2.2.2 determineCost() This function will receive three parameter that will consists of 

the distance, weight and time in hours.

The function must then determine and return the postage cost 

for that particular distance using the information above and 

the information on Table 1.

11

2.2.3 convertTime() This function will receive one parameter that will consists of

the delivery time in minutes.

This function must then convert the given time from minutes 

to hours and it must then return the number of hours in that 

given time.

7

2.2.4 calcAmtDue() This function will receive six parameter that will consists of the

postage cost, an indication whether the insurance is the taken 

and whether the parcel is priority or not, the insurance 

amount, priority amount as well as the amount due.

This function must then calculate the insurance, priority 

amount and the amount due respectively.

7

2.2.5 main() Add necessary pre-processor directives.

NB: The functions must be implemented below the main.

 Declare all necessary constants and variables.

 Allow the program to randomly generate an invoice 

number, the range must be from 105 to 550.

 Prompt the user for the postage details by calling the 

correct function.

 Calculate the postage cost as well as the amount due 

by calling the correct functions. 

 Display the postage details as indicated in Figure 2.3

and Figure 2.4.

 This process must be repeated until there are no 

parcels to deliver (See Figure 2.4).

 Display the number of deliveries for both Local or 

Long distances and the total revenue when the 

program terminates (See Figure 2.5)


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.


input:

ramisgood

godforall


output:

good


input-2:

finally

restforall


Design a communication model that will be used to deploy a wan for your firm.., using ABCD as the branches


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.



input

ramisgood

goodforall


ouput

good


input-2

finally

restforall


output:

No overlapping


Sum of Non-Primes

Write a program to print the sum of non-primes in the given N numbers. The numbers which are not primes are considered as non-primes.Input


The first line of input will contain a positive integer (N).

The following N lines will contain an integer in each line.Output


The output should be the sum of non-primes in the given numbers.Explanation


For example, if the given number is 5, then read the inputs in the next 5 lines and print the sum of non-primes in the given five numbers. If the given input integers in the next five lines are 8, 11, 96, 49, and 25 the output should be 8 + 96 + 49 + 25 is 178.


Sum of Non-Primes

Write a program to print the sum of non-primes in the given N numbers. The numbers which are not primes are considered as non-primes.Input


The first line of input will contain a positive integer (N).

The following N lines will contain an integer in each line.Output


The output should be the sum of non-primes in the given numbers.Explanation


For example, if the given number is 5, then read the inputs in the next 5 lines and print the sum of non-primes in the given five numbers. If the given input integers in the next five lines are 8, 11, 96, 49, and 25 the output should be 8 + 96 + 49 + 25 is 178.


LATEST TUTORIALS
APPROVED BY CLIENTS