There is a secret organization and they
want to create a secret language for the
calculation to make the data secure.
Now the manager of the organization
asked his IT employee to make the
program which will function as follows:
a) * will subtract the numbers b) - will
divide the numbers c) / will add the
numbers d) + will multiply the numbers.
Use operator overloading.
Write a program to find if a year is a leap year or not. We generally assume that if a year number is divisible by 4 it is a leap year. But it is not the only case. A year is a leap year if −
1. It is evenly divisible by 100
2. If it is divisible by 100, then it should also be divisible by 400
3. Except this, all other years evenly divisible by 4 are leap years.
So the leap year algorithm is, given the year number Y,
● Check if Y is divisible by 4 but not 100, DISPLAY "leap year"
● Check if Y is divisible by 400, DISPLAY "leap year"
● Otherwise, DISPLAY "not leap year"
For this program you have to take the input, that is the year number from an input file input.txt that is provided to you. The input file contains multiple input year numbers. Use a while loop to input the year numbers from the input file one at a time and check if that year is a leap year or not. Your output should go in the console.
Write a program that calculates the take-home pay for an employee. The two types of employees are salaried and hourly. Allow the user to input the employee first and last name, id, and type. If an employee is salaried, allow the user to input the salary amount. If an employee is hourly, allow the user to input the hourly rate and the number of hours clocked for the week. For hourly employees, overtime is paid for hours over 40 at a rate of 1.5 of the base rate. For all employees’ take home pay, federal tax of 18% is deducted. A retirement contribution of 10% and a Social Security tax rate of 6% should also be deducted. Use appropriate constants. Design an object-oriented solution. Create a second class to test your design.
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 to find the table of numbers using a while loop. Your program should ask the size of the table. That size defines the rows and columns.
Explain how overloading a unary operator is almost similar to overloading a binary operator with necessary examples and include main() function to demonstrate. Mention the differences between these two in terms of number of operands they deal with.
Explain how overloading a unary operator is almost similar to overloading a binary operator with necessary examples and include main() function to demonstrate. Mention the differences between these two in terms of number of operands they deal with.
Adapt the following code to run in a windows form and also add a button to reset the input length and width boxes.
namespace PaintingEstimate
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Program computes the cost of painting the room");
//inputs room length and width
Console.Write("Enter room length: ");
int length = Convert.ToInt32(Console.ReadLine());
Console.Write("Enter room width: ");
int width = Convert.ToInt32(Console.ReadLine());
//calls method
int totalPrice = ComputePrice(length, width);
Console.WriteLine("Total price: ${0}", totalPrice);
Console.ReadKey();
}
//method computes work price
static int ComputePrice(int length, int width)
{
//price per square foot
int price = 6;
//ceiling
int ceil = 9;
int totalSquare = width * ceil * 2 + length * ceil * 2;
return price * totalSquare;
}
}
}
A customer opens an account at a bank with an initial amount. The account number, name, and balance of the customer are generated. The customer can deposit money and withdraw money as per need, this will modify the existing account balance. It should also be checked if the demanded amount is available during withdrawal. The customer can also close the account, the available amount will be paid out. Write a programme to input and display data for 5 customers with the use of Constructor and Destructor
You are given an M*N matrix and K, write a program to compute the area of the sub-matrix and print the result.
A sub-matrix is a matrix formed after deleting K rows each from the top and bottom and K columns each from left and right.
Area of a matrix is defined as the product of all elements of the matrix.
Explanation
For M = 5 and N = 4, the matrix is:
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
17 18 19 20
For K = 1, the sub-matrix is as follows:
6 7
10 11
14 15
Therefore, the area of the given matrix is 6*7*10*11*14*15 = 970200.
Sample Input1
5 4
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
17 18 19 20
1
Sample Output1
970200