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.
1. An organization has two types of employees: regular and adhoc. Regular employees get a salary which is basic + DA + HRA where DA is 10% of basic and HRA is 30% of basic. Adhoc employees are daily wagers who get a salary which is equal to Number * Wage.
(i) Define the classes shown in the following class hierarchy diagram:
(ii) Define the constructors. When a regular employee is created, basic must be a parameter.
(iii) When adhoc employee is created wage must be a parameter.
(iv) Define the destructors.
(v) Define the member functions for each class. The member function days ( ) updates number of the Adhoc employee.
(vi) Write a test program to test the classes.
An electricity board charges the following rates to domestic users to discourage large consumption of energy.
· For the first 100 units − 50 P per unit
· Beyond 100 units − 60 P per unit
If the total cost is more than Rs.250.00 then an additional surcharge of 15% is added on the difference. Define a class Electricity in which the function Bill computes the cost. Define a derived class More_Electricity and override Bill to add the surcharge.
Create a Weather forecast application that retrieves data, process the data and visulaises the data on the forms of gui. The data is stored in a MySQL database. Temperature, relative humidity and pressure are recorded every ten minutes. The measurements are uploaded to the database and the date and time of successful upload are logged at the database end. The recorded time is therefore the time of storage. It may differ marginally from the actual measurement time.
Please write class for hash table using chaining and it must contain the following functions:
The Rectangular Rule A. 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 approximation on the RHS becomes more accurate as more rectangles are used. In fact, 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.
A contact list is a place where you can store a specific contact with other associated information such as a phone number, email address, birthday, etc. Write a program that first takes as input an integer N that represents the number of word pairs in the list to follow. Word pairs consist of a name and a phone number (both strings), separated by a comma. That list is followed by a name, and your program should output the phone number associated with that name. Output "None" if name is not found.
Ex: If the input is:
3 Joe,123-5432 Linda,983-4123 Frank,867-5309 Frank
the output is:
867-5309
Your program must define and call the following function. The return value of GetPhoneNumber is the phone number associated with the specific contact name.
string GetPhoneNumber(vector<string> nameVec, vector<string> phoneNumberVec, string contactName)
Hint: Use two vectors: One for the string names, and the other for the string phone numbers.
Make a program that will accepts two numbers (first number is for birth month, second number is for birth date) and display its zodiac sign using combined equality and logical operators.
Make a program that will compute and display the sum, difference, product and quotient of two numbers.
NOTE: Not by using arrays.
write a C++ function. in which 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 code in function not by using arrays