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

We want to calculate the total 

marks of each student of a class 

in Physics, Chemistry and 

Mathematics and the average 

marks of the class. The number 

of students in the class are 

entered by the user. Create a 

class named Marks with data 

members for roll number, name 

and marks. Create three other 

classes inheriting the Marks 

class, namely Physics, Chemistry 

and Mathematics, which are 

used to define marks in 

individual subject of each 

student.


Write a C++ program to calculate relativistic kinetic energy (K), when the mass (m) is given by the user. The given below is the equation to calculate the relativistic kinetic energy.




m = mass, v = 1500 ms-1 (speed of the moving object), and c = 12000 ms-1(speed of light)

  • User may insert the mass of the moving objects (m) above or equal to 50 kg and below 100 kg as the highest mass.
  • Consider the speed of light (c) as a constant value.
  • Then the program should calculate the relativistic kinetic energy (K) for each mass of the moving object until the mass becomes 39 kg.
  • Use the necessary header files to do the calculation.

 Sample Output


Enter a mass of the moving objects (m): 60


60    8.7083e+09

59    8.56316e+09

58    8.41802e+09

57    8.27289e+09

56    8.12775e+09



. A right triangle can have sides whose lengths are all integers. The set of three integer 

values for the lengths of the sides of a right triangle is called a Pythagorean triple. 

The lengths of the three sides must satisfy the relationship that the sum of the squares 

of two of the sides is equal to the square of the hypotenuse. Write an application that 

displays a table of the Pythagorean triples for side1, side2 and the hypotenuse, all no 

larger than 500. Use a triple-nested for loop that tries all possibilities. This method is 

an example of “brute-force” computing. You’ll learn in more advanced computer 

science courses that for many interesting problems there’s no known algorithmic 

approach other than using sheer brute force.


Write a C++ program called onlineB.cpp to calculate horizontal range of the projectile motion (R) when a baseball player throws a ball at a speed of 30 ms-1 and the angle (in degrees) is given by the user. The given below is the equation to calculate the horizontal range of the projectile motion.


v = 30.0 (speed of the throwing), g = 9.8 (gravity), and θ = angle in radians

  • User may insert an angle above or equal 45° and below 60° as the highest angle.
  • Then the program should calculate the horizontal range of the projectile motion (R) for each angle until the angle become 35°.
  • Consider the gravity (g) as a constant.
  • You are required to calculate the 𝜃 in radians by using the given formula (PI = 3.14286 which is a constant).
  • Use the necessary header files to do the calculation.

 Sample Output

 

Write a program that prints the result of rolling one fair 

dice.

Hint: use the rand() function with range given in 

arguments to generate a random integer in the desired 

range. 

Add a loop to print the sum of rolling 10 fair dice.

Add a second loop to repeat this N times, printing the 

sum after each trial. 

Maintain an array count[] so that count[k] stores the 

number of times the sum is exactly k.

Review your code and eliminate glitches and unnecessary 

repetitions if any


Write c++ code to display avarage of all the element of array (hint [I] =4*I+1 and size of array=5)


Write a program which has a class called String containing a character array as a data member. The class should contain constructor for input and an appropriate member function for throwing an exception in case the ASCII value of a character is prime. You may use any other data members or member functions you deem necessary for computing the answer


Given a string, write a program to return the sum and average of the numbers that appear in the string, ignoring all other characters.


Input

The input will be a single line containing a string.


Output

The output should contain the sum and average of the numbers that appear in the string.

Note: Round the average value to two decimal places.


Explanation

For example, if the given string is "I am 25 years and 10 months old", the numbers are 25, 10. Your code should print the sum of the numbers(35) and the average of the numbers(17.5) in the new line.


Input 1:-

I am 25 years and 10 months old

Output 1:-

35

17.5


Input 2:-

Tech Foundation 35567

Output 2:-

35567

35567.0


Input 3:-

Anjali25 is python4 Expert

Output 3:-

29

14.5


We want given both three inputs they can get both three outputs we code was run one by one input and output


Write a program which has an abstract class called Number having an integer data member. The class contains a pure virtual function called operation. A class called odd is derived from class called Number. Another class called Even is derived from class Number. Yet another class called prime is derived from Number. Use appropriate constructors and redefine the function called operation to display if the number is odd, even or prime. You may make use of other data members and member functions if needed


Compare the methods of determining prime numbers with code and concept.

i.Naive method

ii.square root method

iii.Seive of Eratosthenes


LATEST TUTORIALS
APPROVED BY CLIENTS