Task 1: Create a library project and define a class called Participant. Define the private members and public properties as follows: EmpId, Name, Company Name, FoundationMarks, WebBasicMarks, DotNetMarks, Total Marks, ObtainedMarks, Percentage Initialise the Total Marks to 300. ObtainedMarks and Percentage are calculated fields.
Task 2: Add 3 constructors, one Default, one parameterised to initialize the members and one static constructor to initialise the company Name to “Corporate Unniversity”
Task 3: Add the following functions to the class: a. To calculate Total Marks. b. To calculate the percentage. c. To return the percentage
Task 4: Create a console application to accept the data about participants, and create the object. The console application should call the appropriate functions to calculate the Total Marks and Percentage. And then Display the percentage.
Mahesh has created the following code. The purpose is to create Circle and Triangle class by inheriting the Shape Class. Both the inherited classes should override the WhoamI() method of the Shape Class. The code has some bugs. Identify the Bugs and fix them.
public class Shape
{
private void WhoamI()
{
Console.WriteLine("I m Shape");
}
}
class Triangle : public Shape
{
public virtual void WhoamI()
{
Console.WriteLine("I m Triangle");
}
}
public class Circle : public Shape
{
void WhoamI()
{
Console.WriteLine("I m Circle");
}
}
class Program
{
static void Main(string[] args)
{
Shape s;
s = new Triangle();
s.WhoamI();
s = new Circle();
s.WhoamI();
Console.ReadKey();
}
}
The contract Employee class will have Perks as an additional property. The PermanentEmployee will have NoOfLeaves and ProvidendFund Properties.
1. Create these two classes by inheriting from the Employee class.
2. Override the GetSalary Method in these two classes. For Contract employee the new salary will be Salary + Perks. For Permanent Employee the new salary will be Salary – Providend Fund.
3. Create a console application to use these classes. Create a Menu driven application to select the Type of employee. Based on the user selection create the object and accept the details from the user. Also display the salary of the Employee.
4. As we only need to create instance of Contract Employee and Permanent Employee classes, Convert the Employee class to Abstract class. Also make GetSalary method Abstract in the Base class.
Ordered Matrix
Given a M x N matrix, write a program to print the matrix after ordering all the elements of the matrix in increasing order.
Input
The first line of input will contain two space-separated integers, denoting the M and N.
The next M following lines will contain N space-separated integers, denoting the elements of each list.
Output
The output should be M lines containing the ordered matrix.
Note: There is a space at the end of each line.
Explanation
For example, if the given M is 3 and N is 3, read the inputs in the next three lines if the numbers given in the next three lines are the following.
1 20 3
30 10 2
5 11 15By ordering all the elements of the matrix in increasing order, the ordered matrix should be
1 2 3
5 10 11
15 20 30Sample Input 1
3 3
1 20 3
30 10 2
5 11 15
Sample Output 1
1 2 3
5 10 11
15 20 30
Sample Input 2
2 5
-50 20 3 25 -20
88 17 38 72 -10
Sample Output 2
-50 -20 -10 3 17
20 25 38 72 88
Write a complete program that will convert Malaysian Ringgit to Japanese Yen and Singapore Dollar. The user will have to input an amount in Malaysian Ringgit and the program will then display its equivalent amount in Japanese Yen and Singapore Dollar.
Note: 1 Japanese Yen is 0.040 Malaysian Ringgit 1 Singapore Dollar is 3.03 Malaysian Ringgit
Write a program that initializes an array of size 10 with 10 integer values between 1 and 100. The program then asks the user to enter an integer number between 1 and 100. The program will search the entered number in the array, if it is present the program displays its index in the array otherwise program displays “element not found” message.
Write a program that declares 2 integer arrays x, y of size 10 each. The program then reads values for x and y arrays from the user (use some common values).
Finally the program finds the common values in x and y and prints them. If there is no common values in x and y print “There is nothing common between array x and y”.
Define a single dimension array of strings to hold the name of City. Accept some values from the user and store them in the array. Use for-each loop to print all the data of the array.
You have the String marks="60";
You want to use marks in in the method grading(int mk) which receives the marks and the return the corresponding grade. Which processing must be doe to marks for it to work ?
The class student contains roll number, name, and course as data members and Input_student and display_student as member functions. Create a class exam and publicly inherit it from the student class. The derived class contains an array of marks and no_of_subjects as data members and input_marks and display_result as member functions. Overload “<=”, “()” and “+=” operators and use the overloaded operators in the main function. Create an array of objects of the exam class and display the result of 5 students.