Sei sulla pagina 1di 6

c 

  
                  

     c     

 
Task 1

· Write a C# program to print your name in the format of lastname,firstname

· Compile the program in the DOS prompt and run it

Task 2

· Modify the above program to print your name via the static method called "printName"

· Compile the program to generate the dll file

Task 3

· Write another C# program to print your name by calling the above printName method

· Compile the program and run it.

Task 4

· Modify the program created in Task 3 to read the first name and last name from command line and

print in the format of lastname,firstname

 
· Write a program to read the month name ( in 3 letter lower case format, example jan ,feb...) and

print the quarter in which the given month falls. For example jan- mar is the first quarter. apr-jun is

the second quarter.. ·

Write a program to print the factorials of the integers from 1 to 20

  
Write an Employee class to record the following attributes and behaviors for an Employee·

Declare the following instance variables

o string firstName

o string lastName
o string address

o long sin;

o double salary

· Implement a constructor to initialize all the member variables from given parameters

· Override the ToString method to print the employee info in a good presentable format

· Define a method to calculate the bonus ( salary x percentage where percentage is given as


· Define properties for firstName, lastName and address. Write a Test program to test all the

behaviors of above Employee class.

  
Write a Book class to represent a Book

· Declare the following instance variables

o string author

o int pages

o string isbn

o string title

o int current page

· Implement a default constructor to sets the current page to 1


· A destructor method (do nothing for now)

· A property Author (both setter and getter for author)

· A property ISBN that has only get accessor for isbn

· A method flipPageForward

· A method flipPageBackward

Write a Test program to test all the behaviors of above Book class.

   Given,
public abstract class GeometricObject

protected string color;

protected double weight;

// Default construct

protected GeometricObject()

color = "white";

weight = 1.0;

// Construct a geometric object

protected GeometricObject(string color, double weight)

this.color = color;

this.weight = weight;

public string color


return color;


color = value;

public double Weight


return weight;


weight = value;

// Abstract method

public abstract double findArea();

// Abstract method

public abstract double findPerimeter();

1. Write a class named Circle which inherits GeometricObject class. Circle has a field called radius.

· Provide two constructors - one is with single parameter ( for radius) and the other one with three

parameters ( for radius, color, weight )

· Override the ToString() to print the object

2. Write a Test program to test all the behaviours of Circle class

3. Modify the test program to read radius, color and weight from command line and handle exceptions

in the following situations

· When command line parameters are not given or not enough

· When radius value is not a numeric value

  
Implement a class named Person and two sub classes of Person named Student and Employee. Make

Faculty and Staff sub classes of Employee.

A Person has a name, phone number and email address. A student has a program to which he/she

enrolled ( Business, Computer Science...) . An Employee has a department, salary and the date hired.

A faculty member has office hours and a rank. A staff member has a title You are required to
1. Override the ToString() to display the class name and the person's name and email address.

2. Provide properties in each class to read and write it's fields

3. Define a CalculateBonus and CalculateVacation as abstract methods in Employee class and

implement them in Faculty and Staff as follows

o Faculty get 1000 + 0.05 x Salary and Staff get 0.06 x Salary

o Faculty get 5 weeks if they are employed more than 3 years and additional one week if he/she is

"Senior Lecturer". Otherwise 4 weeks. Staff get 4 weeks for 5 year service. Otherwise get 3 weeks.

  
Write a custom exception named AmountException to handle the following business issues

· When Senior Lecture gets less than 60,000 salary

· When bonus is more than 10,000

Your exception class should have a field named personName to store the person's name.

Write a Test program to work with various class objects and their behaviours. Add some code to

demonstrate the polymorphism. Also show the functionality of your custom exception class by adding

some appropriate code.

  
Write a Mortgage Calculator windows application to calculate monthly payment.

Monthly payment (M) formula:


1 - ( 1 + J ) ^ -N

· P = principal, the initial amount of the loan

· I = the annual interest rate (from 1 to 100 percent)


· J = monthly interest in decimal form = I / (12 x 100)

· N = number of months over which loan is amortized = L x 12

  
Implement the Simple Notepad windows application to have the following tasks.

· Add menus to change the fonts ("Times New Roma", "Arial" and "Default" ) and the sizes (12,16,

"Default" )

· Change the format styles to be toggled

· Add color and style selection to context menu

· Implement "toUppercase" and "toLowercase" in the context menu to change the case of the selected


  
Create a user control called MyEventCalendar. The control contains a Label labeled "Event Name", a

TextBox to enter a event name and a DateTimePicker . The control must provide public read only

properties Event and Time to retrieve the event name and time. The user control must be exported to

an application that displays the values input by the user in the control

 :

· Microsoft Visual Studio 2005

· Microsoft Visual C# 2005 Express Edition


various other utilities to aid development.

· SharpDevelop is a free IDE for C# and VB.NET.

