String Slicing
Given two strings
inputString and subString as inputs, write a JS program to slice the inputString if it includes the subString. Slice the inputString starting from the subString to the end of the inputString.
Write a program to find out greatest among three numbers. Define two classes, first class KBC contain two data members a and b, and second class BBC only one data member c. Input data to the data members by defining appropriate member functions. A member function max() defined in second class BBC to find out the greatest among three numbers. Solve this problem by using friend function.
Write a program to find out the area of an rectangle be defining a class named as Rectangle having length and breadth as its data members. Declare another class named as Rectangle Area having one member function named as area to calculate the area by taking the data length and breadth from the Rectangle class. Solve this by using friend class.
Write a program to exchange values(swap) between two classes by using friend function(call by reference).
Write a program by using friend function to add data objects of two different classes ABC and XYZ.
Create a class that includes a data member that holds a “serial number” for each object created from the class. That is, the first object created will be numbered 1, the second 2, and so on. To do this, you’ll need another data member that records a count of how many objects have been created so far. (This member should apply to the class as a whole; not to individual objects. What keyword specifies this?) Then, as each object is created, its constructor can examine this count member variable to determine the appropriate serial number for the new object. Add a member function that permits an object to report its own serial number. Then write a main() program that creates three objects and queries each one
You will need to complete the following objectives as a Java Application: 1. When the program starts the user needs to be asked if they want to make a new entry or to view a previous entry 2. If the user wants to make a new entry, the first question will be how many meters they travelled (this will then need to be converted into kilometers) 3. The second question will give the user 3 options to choose from, and each option will have a value. The options are as follows: a. Hatchback = 3 b. SUV = 3.5 c. Sports car = 4. When the user has selected an option that options value needs to be multiplied by the distance they travelled in kilometers 4. The third question will allow the user to enter a description, of where they travel to and why did they travel there. 5. All the information above needs to then be saved into a JSON file 6. If the user says he want to view a previous entry the JSON file needs to be loaded and displayed.
Employee
-name: String
+Employee() <<constructor>>
+Employee(String)<<constructor>>
+toString(): String
+setName(String): void
+getName(): String
+getSalary(): double
+getHours(): double
+getLeaveDays(): int
+leaveApplication(): void
+work(): void
Manager
+Manager()<<constructor>>
+Manager(String)<<constructor>>
+getLeaveDays(): int
+getSalary(): double
+leaveApplication(): void
+work(): void
Secretary
+Secretary()<<constructor>>
+Secretary(String)<<constructor>>
+getHours(): double
+work(): void
a. Add a minimum of 10 objects to the array. You may hard-code these object values. The objects must be a mixture of Employee, Manager and Secretary. b. Display all the objects on the screen. c. Calculate, and then display, the average salary of all employees. Extra Calculate and display the cost of the leave to the company for each employee.