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 & Filtering

Suppose that the input is:


38 35 71 14 -1


What is the output of the following code? Assume all variables are properly declared.


sum = 0;

num = console.nextInt();

while (num != -1)

{

sum = sum + num;

num = console.nextInt();

}

System.out.println("Sum = " + sum);


Write and run a visual payroll program for 10 employee of a company.The gross pay sums the basic pay, housing allowance and professional allowance (where applicable).Workers grade levels range from 1to 16. Housing allowance of workers is 30% of basic pay for workers on levels 8 to 16 and 40% for levels 1-7 workers.Transport allowance is 20% of basic pay for all workers. Hazard allowance is 15% of basic pay for only levels 8-16 workers. The net pay, which is the take home pay is the gross pay tax (10% of gross pay). Designs form through which each workers data can be entered


  1. Write the Arithmetic Functions program with the following instructions:                      [2 x 5 = 10]
  2. Create class 1 containing the methods Add, Subtract, Multiply, Divide and Modulus
  3. Class 1 should not contain main method
  4. All the methods written in class 1 should be given the Values as Parameters (at least 2 integers)
  5. Create class 2 with the main method only
  6. Create the Object of class 1 and call all the methods of class 1 using the object.
Numbers in String - 2
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.
Sample Input 1
I am 25 years and 10 months old
Sample Output 1
35
17.5

Sample Input 2
Tech Foundation 35567
Sample Output 2
35567
35567.0

sample input 3
1time3 %times4
sample output 3
8
2.67

write an interactive menu driven c++ program that creates a text file (say text1) and then display the file. create another text file (as text) by converting each line of the 'text1' file into a lowercase string. display the contents of 'text' file.


Numbers in String - 1
Given a string, write a program to return the sum and average of the digits of all 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 digits of all 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 digits of all numbers that appear in the string are 2, 5, 1, 0. Your code should print the sum of all digits(8) and the average of all digits(2.0) in the new line.
Sample Input 1
I am 25 years and 10 months old
Sample Output 1
8
2.0

Sample Input 2
Tech Foundation 35567
Sample Output 2
26
5.2

Sample Input 3
Anjali25 is python4 Expert
Sample Output 3
11
3.67

You are required to: v. write pseudocode algorithm to determine the integral of a function between two specified points using the rectangular rule. vi. write C++ computer programs to determine the integral of a function between two specified points using the rectangular rule.


The rectangular rule (also called the midpoint rule) is perhaps the simplest of the three methods for estimating an integral. i. Integrate over an interval a ≤ x ≤ b. ii. Divide this interval up into n equal subintervals of length h = (b − a)/n. iii.Approximate f in each subinterval by f(x*j ), where x*j is the midpoint of the subinterval. iv. Area of each rectangle: f(x*j)h, f(x*j)h,. . . , f(x*n)h.


The bisection method is used to find the roots of a polynomial equation. It separates the interval and subdivides the interval in which the root of the equation lies. The principle behind this method is the intermediate theorem for continuous functions. It works by narrowing the gap between the positive and negative intervals until it closes in on the correct answer. This method narrows the gap by taking the average of the positive and negative intervals. For any continuous function f(x), i. Find TWO (2) points, say a and b such that a < b and f(a)* f(b) < 0 ii. Find the midpoint of a and b, say “t” iii. t is the root of the given function if f(t) = 0; else follow the next step iv. Divide the interval [a, b] v. If f(t)*f(b) <0, let a = t vi. Else if f(t) *f(a), let b = t vii. Repeat above three steps until f(t) = 0.


Maximum Subarray Sum (Divide and Conquer)

Description

You are given an array containing 'n' elements. The array can contain both positive and negative integers. Determine the sum of the contiguous subarray with the maximum sum.

 

Consider the array {8, -9, 3, 6, 8, -5, 7, -6, 1, -3}.

The maximum subarray will be 3, 6, 8, -5, 7.

The maximum subarray sum will be 3+6+8+(-5)+7 = 19

 

Input Format:

The input contains the number of elements in the array, followed by the elements in the array.

 

Output Format:

The output contains the maximum subarray sum.

 

Sample Test Cases:

Input:

10 8 -9 3 6 8 -5 7 -6 1 -3


Output:

19 

 

Input:

5 8 9 4 5 7

 

Output:

33


LATEST TUTORIALS
APPROVED BY CLIENTS