Questions: 9 913

Answers by our Experts: 9 913

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

Read about doing multiplication using Karatsuba method

(https://en.wikipedia.org/wiki/Karatsuba_algorithm ).

Write a C++ program which:

• Prompts user to enter two large integer numbers (x, y).

• Make a function called Karatsuba() which takes these two integers and returns the

multiplication result using Karatsuba algorithm.

o Your function should do parameter validation. Both numbers must be more

than 4 digits and less than 10 digits (don’t use strings). If parameters are not

valid then the function should return 0;

o The entered numbers could be negative or positive. For example: 820778 and

-58712979 where x is 6-digit positive number and y is 8-digit negative

number.


• You might need to make another helper function called getDigits() which will get an

integer as input and returns number of digits of that integer. getDigits() will help you

find the value of m and Bm.

• Finally, display result in the main function


Write a C++ Function program that takes up to 10-digit integer input from user (can be 1 digit, 2 digit, and

so on..); passes this to a function which reverses the digits. Finally, the reversed number should

be displayed in the main function. For example: when user enters 10-digit like 1234567890 your

function will reverse it to 987654321. Do not use strings. Be careful for big integer values. [use

functions, decision control]



Wite a C++ function. A college offers a course that prepares students for the state licensing exam for real estate brokers.

Last year, ten of the students who completed this course took the exam. The college wants to know

how well its students did on the exam. You have been asked to write a program to summarize the

results. You have been given a list of these 10 students. Next to each name is written a 1 if the

student passed the exam or a 2 if the student failed.

Your program should analyze the results of the exam as follows:

Input each test result (i.e., a 1 or a 2). Display the prompting message "Enter result" each time the

program requests another test result.

Count the number of test results of each type.

Display a summary of the test results indicating the number of students who passed and the

number who failed.

If more than eight students passed the exam, print the message "Raise tuition."


Write a C++ program .A number is called a happy number, if you start with the given number

and arrive at 1 by repeating the following process (as illustrated in the below example):

(a) compute the sum of the squares of given number digits

(b) if the resultant value is 1, then the number is happy number, else execute point (a) for

the newly produced number.

Note that if a number is not a happy number, there will be an endless loop to this execution.

Goal: In this question, you are required to write a recursive function that checks whether

the number entered by the user is a happy number or not for 10 cycles/iterations only. The

output shown in blue colour should be shown by the function and text in yellow colour

should be displayed by the main function.

Enter a number: 19

Number Computation Result cycle/iterations

19 1 2 + 9 2 82 1

82 8 2 + 2 2 68 2

68 6 2 + 8 2 100 3

100 1 2 + 0 2 +0 2 1 4


I tried 19 for happy number

I tried 4 iterations.

19 is a happy number



write a C++ program.A number is called a happy number, if you start with the given number

and arrive at 1 by repeating the following process (as illustrated in the below example):

(a) compute the sum of the squares of given number digits

(b) if the resultant value is 1, then the number is happy number, else execute point (a) for

the newly produced number.

Note that if a number is not a happy number, there will be an endless loop to this execution.

Goal: In this question, you are required to write a recursive function that checks whether

the number entered by the user is a happy number or not for 10 cycles/iterations only. The

output shown in blue colour should be shown by the function and text in yellow colour

should be displayed by the main function.

Enter a number: 19

Number Computation Result cycle/iterations

19 1 2 + 9 2 82 1

82 8 2 + 2 2 68 2

68 6 2 + 8 2 100 3

100 1 2 + 0 2 +0 2 1 4


write a C++ program for a Semi-autonomous vehicle (Self-Driving Car) that has the

following requirements. Class name is Car that contains the following attributes.

• The name of car

• The direction of car (E,W,N,S)

• The position of car (from imaginary zero point)

• Create a rough Map of the way you come to school (e.g go east for x distance, go west

for x distance, etc) and use the class that you just created a function and pass in these

values and print the steps. For example, I turn west for 200m so it would print: “Moving:

West for distance: 200” (Translate the map into code)



Define a function named GetWordFrequency that takes a vector of strings and a search word as parameters. Function GetWordFrequency() then returns the number of occurrences of the search word in the vector parameter (case insensitive). 

Then, write a main program that reads a list of words into a vector, calls function GetWordFrequency() repeatedly, and outputs the words in the vector with their frequencies. The input begins with an integer indicating the number of words that follow. 

Ex: If the input is:

5 hey Hi Mark hi mark

the output is:

hey 1
Hi 2
Mark 2
hi 2
mark 2

Write a program to design a class complex to represent negative numbers. The negative class


should use an external function (use it as friend function) to add two negative numbers. The


function should return an object of type negative representing the sum of two negative


numbers.

Create a class Employee having basic its details like name, age, Salary etc. Let there be a function show details which will print all the values for the data members. Further, inherit the same class to create two different classes Developer and Manager.


Implement the concept of runtime polymorphism by invoking the show details function


A bookshop gives discount to customers as follows: • Students get 10% discount, • Book dealers get 12% discount and • Pensioners get 15% discount. • All other customers get 10% discount only if their total purchases are more than R200. You are requested to write two versions of a program that calculates and displays the final amount that is due, after discount. (i) The first version of the program uses a switch statement to implement the above program. (ii) The second version of the program uses nested-if statements. Hint: Use the following variables: float amount; // the amount due before discount char customer Type; // the type of customer: 'S' (student) or // 'D' (dealer) or 'P' (pensioner) or


LATEST TUTORIALS
APPROVED BY CLIENTS