Write a program that reads a 4 digit (or fewer) positive integer and determines
how many digits in the integer are equal to the last character of your Roll number,
and prints the result on the screen. If a user enters a negative integer or an
integer greater than 4 digits, print a message on the screen: “Invalid integer!
Execute program again and enter a valid integer.” Also, write the pseudocode for
this program.
Make all the
appropriate function constant. Include a constant data member called id of integer
type.
Create two object constant and non-constant. Assign values and display them. Also
check what happens
If you try to modify private data member of an object from the definition of
const function
If you try to modify the private data member of const object from the
definition of non-constant function.
Area of a circle is π × r2 where r = radius
Area of a triangle is ½ × b × h where b = base, h = height
Area of a rectangle is w × h w = width, h = height
Area of a square is a
2 where a = length of side
Write four different functions with same name that is Area to calculate the area of
circle, triangle, rectangle and square.
At the end of a financial year a company decided to give bonus for their employees. The bonus for each employee is calculated as n times of their basic salary. n is a number between 0 and 2.
You are asked to write a C program to calculate the bonus given for the employees.
Write a function called calcNoOfTimes() to calculate and return the number of times for each employee. Number of times depend on the employee category as shown in the following table.
Employee Category No of times
1 1.0
2 1.5
Other ( 3 - 9) 2.0
In your main function enter the employee category and the salary of an employee from the keyboard. Calculate and display the bonus given for the employee using the above implemented functions.
Enter Salary : 15000.00
Enter employee number : 2
Bonus : 22500.00
Write a function to sort data. (in increasing order) in an array using
a. pass by value
b. and pass by reference.?
Write a. program that inputs a string value from the user and displays it in
reverse using pointer.?
Write a program that prompts the user to enter a person’s date of birth in numeric form such as 8-27-1980. The program then outputs the date of birth in the form: August 27, 1980. Your program must contain at least two exception classes: invalidDay and invalidMonth. If the user enters an invalid value for day, then the program should throw and catch an invalidDay object. Follow similar conventions for the invalid values of month and year. (Note that your program must handle a leap year.)
Write a program that prompts the user to enter time in 12-hour notation. The program then outputs the time in 24-hour notation. Your program must contain three exception classes: invalidHr, invalidMin, and invalidSec. If the user enters an invalid value for hours, then the program should throw and catch an invalidHr object. Follow similar conventions for the invalid values of minutes and seconds.
Write a program that prompts the user to enter a length in feet and then enter a length in inches and outputs the equivalent length in centimeters. If the user enters a negative number or a non-digit number, throw and handle an appropriate exception and prompt the user to enter another set of numbers.
Your error message should read A non positive number is entered and allow the user to try again.
Format your output with setprecision(2) to ensure the proper number of decimals for testing!