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

Create a class called Rational for performing arithmetic with fractions. The result should be stored in reduced form. Use integer variables to represent the private data of the class— the numerator and the denominator. Provide a constructor that enables an object of this class to be initialized when it’s declared. The constructor should contain default values in case no initializers are provided and should store the fraction in reduced form. For example, the fraction would be stored in the object as 1 in the numerator and 2 in the denominator. Provide public member functions that perform each of the following tasks:

The result should be stored in reduced form of all these parts except part (f):

a) Adding two Rational numbers.

b) Subtracting two Rational numbers.

c) Multiplying two Rational numbers.

d) Dividing two Rational numbers.

e) Printing Rational numbers in the form a/b using << operators.

f) Printing Rational numbers in floating-point format using << operators.



Let's define P[i] as the ith Prime Number. Therefore, P[1]=2, P[2]=3, P[3]=5, so on.



Given two integers L, R (L<=R), find the value of P[L]+P[L+1]+P[L+2]...+P[R].



I

bunty birthday:

hey!!its bunty bithday

bunty was born on 13 June 2000 he is curious to know ow many people in is locality have their birthdays on the same day,month,year

given buntyBirthday in the prefilled code and a birthdayList as an input, write js program to find the number of people having their birthdays

on the same day

in the same month

in the same year

input:['2000-05-13' , 'June 7 2021' ,'03/24/2000']

output:


1

2

["2011-12-31","2011-02-14",'June 17 1998','12/02/1990','1995-10-23']

o/p:


1




before the game start,they flip a coin to decide the starting player

the starting player choose a box & places the ball in it

if the ramesh starts he always places the ball in the box containing the biggest number

similarly suresh places the ball inthe box containing the smalllest number

after in each turn the player can move the ball one box to the left or one box to the right

ramesh plays such that he always moves the ball to the box containing a bigger number

suresh always moves the ball to the box containing a smaller number

ramesh plays in such a way that when the game ends,the number on the box which contains the ball is the biggest possible on the contry, suresh wants this number to be te smallest possible the result of the game is the number written on the box containing the ball after k turns write a program to determine the result of the game

i/p:2

4 3 0

4 1 9 5

4 3 1

4 1 9 5

o/P:

9

1



Consider now the function f(x) = x^4-2x^3− 12x^2 + 16x − 4 which has four distinct roots.



Question 10


Choose the appropriate option:



(1) The secant method and Muller’s method are similar in the sense that they both start with two


points.



(2) The regula falsi and the secant methods are the same and convergence for the regula falsi is


guaranteed because the next approximation is bracketed.



(3) Muller’s method determines the next approximation by considering the intersection of a parabola


and the x-axis through three given points.



(4) Statements (2) and (3) are correct.



(5) none of the above statements

Consider now the function f(x) = x^4−2x^3 − 12x^2 + 16x − 4 which has four distinct roots.



Question 8


Which of the following options is FALSE?


(1) f'(x) has a local minimum at 2.



(2) f'(x) has a local maximum at −1.



(3) f(x) has no singularities and no obvious symmetries and the y-intercept is −4.



(4) f"(x) has a local maximum at x = 0.5.



(5) the two zeros of f"(x) are −1 and 2.





Question 9


Which of the following results is FALSE when applying the various methods as indicated:



(1) p = 0.88338140 when applying the secant method with starting points p0 = 0 and p1 = 1.



(2) p = 0.34170924 when applying the bisection method with the starting points p0 = 0 and p1 = 1.



(3) p = 0.34170924 when applying Newton’s method with starting point p0 = 0.



(4) p = 0.88338140 when applying Muller’s method with starting points p2 = 0, p0 = 1 and p1 = 5.



(5) p = 4.04823531 when applying the regula falsi method with starting points p0 = 1 and p1 = 5.

proper fractions

Given two fractional values A/C ,B/D where A,B are numbers and C,D are denominators you asked to add two fractional values, if the sum gives proper fraction as output print the proper fraction if it is improper ,convert it into a mixed fraction and print it if it is a whole number, print it

the 1st line of input contains two space separeted strings A/C, B/D

input:

1/2 1/4

o/p:

3/4

i/p:

1/2 3/4

o/p:

11/4(that means 1(1/4))

i/p:

1/3 2/3

o/p:

1


(For Questions 6 to 7 )


Consider the nonlinear equation sin x − e


−x = 0, which has a roots in the intervals [0, 1], [3, 4] and


[6, 7].



Question 7


Consider again the nonlinear equation sin x − e


−x = 0. Applying the regula falsi method, with


starting point p0 = 3 and p1 = 4 and a tolerance of 10−5 yields the following result :



(1) 0.589117 after at least three iterations



(2) 0.588641 after at most three iteration



(3) The method does not converge to a solution.



(4) 3.096308 after exactly three iterations



(5) None of the above is true.


Consider now the function f(x) = x


4 − 2x


3 − 12x


2 + 16x − 4 which has four distinct roots.

(For Questions 6 to 7 )


Consider the nonlinear equation sin x − e


−x = 0, which has a roots in the intervals [0, 1], [3, 4] and


[6, 7].



Question 6


Which of the following is FALSE.


(1) The fixed-point formula g(x) = x + sin x − e


−x converges to the approximate solution p =


3.09636393 if the initial approximation is p0 = 1.



(2) Newton’s method with p0 = 0.5 will converge to the approximate solution p = 0.588532744


after at most three iterations.



(3) The regula falsi method converges to p = 0.5885328664 if p0 = 0, p1 = 1 after ten iterations.



(4) Newton’s method with p0 = 1 will converge to the approximate solution p = 0.588532743982


after exactly 4 iterations



(5) The fixed-point method does not converge if p0 = 0.5.

Dice Score:

two friends are playing a dice game, the game is played with five six-sided dice. scores for each type of throws are mentioned below.

three 1's = 1000 points

three 6's = 600

three 5's = 500

three 4's = 400

three 3's = 300

three 2's = 200

one 1 = 100

one 5 = 50

I/p: 2

1 1 1 1 1

6 6 6 1 5

O/p: 1200

750

I/p: 2

2 1 5 2 2

1 1 1 2 2

O/p: 350

1000


LATEST TUTORIALS
APPROVED BY CLIENTS