Write a program using class “string”. Pass a string as arguments to the constructor of the class and initialize it in a data member “str”. The class should have the following member function:
◦ One member function “strlength” to find and return the length of string.
◦ One member function ‘lowercase’ to convert the string into lowercase.
◦ One member function ‘uppercase’ to convert the string into uppercase.
Write a program to display the record of an employee using base class and derived class. The name of the base class should be emp_address and name of the derived class should be emp_allowance. Use the constructor with arguments in both classes and assign data to the object of the derived class
Prepare coding for the above using Flutter for an Android App.
From a set of array elements, find the number of occurrences of each element present in the given array
Input:
5
2
4
2
5
Output
2 occurs 2 time
4 occurs 1 time
5occurs 2 time
From a set of array elements, find the number of occurrences of each element present in the given array.
Input :
5
2
4
2
5
Output:
2 occurs 2 time
4 occurs 1 time
5 occurs 2 time
Design a C program to exchange the keys. The Two friends Bob and Jim met in a bank and discussed about their secret code. They decided to exchange their passwords for further transactions. Password of Bob is "Apple" and Jim is Orange". Print the password of Jim and Bob.
Input :
Apple Orange
Output :
Orange Apple
Task 1: Convert a number string to number Write a C function str_to_float() that takes a numeric string as input and converts it to a floating point number. The function should return the floating point number by reference. If the conversion is successful, the function should return 0, and -1 otherwise (e.g. the string does not contain a valid number). The prototype of the function is given below int str_to_float(char * str, float * number);
Task 2: Find median in a 2D array Write a function median_2d()that computes the median for a 2D numeric array (matrix). The inputs to the function are a pointer to the start of the array, and its dimensions (rows and cols). Your function should not modify the contents of the original matrix!
The function prototype is given below. float median_2d(float * ptr_array, int rows, int cols);
Domain knowledge:
The median is the middle number in a sorted, ascending or descending, list of numbers and can be more descriptive of that data set than the average.
If there is an odd amount of numbers, the median value is the number that is in the middle, with the same amount of numbers below and above.
If there is an even amount of numbers in the list, the middle pair must be determined, added together, and divided by two to find the median value.
Hint: In memory a 2D array is stored just like a 1D array
Differentiate the properties of the following two derived classes?
(i) class X : public A{//..}
(ii) class Y : private A{//..}
Design a class named Staff that includes A data member named staffID A parameterized constructor to initialize staffID A getter function to get the value of staffID Derive a class named doctor inherited from Staff class and contains Two additional data members i.e. departmentID and departmentName A parameterized constructor to initialize its own data fields along with the inherited data field Two getter functions that return the departmentID and departmentName, respectively Derive a class named VisitingDoctor inherited from class Doctor and has A data field named no_of_patients A data field named fee_per_patient A function named totalSalary that returns total payment for all patients A member function named display to show total salary of visiting doctor. A member function name datawrite in which you write all the information against visiting doctor in a text file. The name of the file is your name.