C# Programming Assignments
C# Programming Assignments
Following is a list of some interesting assignments you may find them interesting to
Assignment1:
Task 1
Task 2
· Modify the above program to print your name via the static method called "printName"
Task 3
· Write another C# program to print your name by calling the above printName method
Task 4
· Modify the program created in Task 3 to read the first name and last name from command line and
Assignment 2:
· 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
Assignment 3:
Write an Employee class to record the following attributes and behaviors for an Employee·
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
parameter)
· Define properties for firstName, lastName and address. Write a Test program to test all the
Assignment 4:
Write a Book class to represent a Book
o string author
o int pages
o string isbn
o string title
· Implement a constructor to initialize all the member variables from given parameters
· A method flipPageForward
· A method flipPageBackward
Write a Test program to test all the behaviors of above Book class.
Assignment 5: Given,
public abstract class GeometricObject
// Default construct
protected GeometricObject()
color = "white";
weight = 1.0;
this.color = color;
this.weight = weight;
get
return color;
set
color = value;
get
return weight;
}
set
weight = value;
// Abstract method
// Abstract method
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
3. Modify the test program to read radius, color and weight from command line and handle exceptions
Assignment 6:
Implement a class named Person and two sub classes of Person named Student and Employee. Make
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.
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.
Assignment 7:
Write a custom exception named AmountException to handle the following business issues
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
Assignment 8:
Write a Mortgage Calculator windows application to calculate monthly payment.
M = P x ------------------------
1 - ( 1 + J ) ^ -N
· L = length, the length (in years) of the loan, or at least the length over which the loan is amortized.
Assignment 9:
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" )
· Implement "toUppercase" and "toLowercase" in the context menu to change the case of the selected
text
Assignment 10:
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
Recommended Software:
· .NET Framework SDK is free and includes command- line compilers for C++, C#, and VB.NET and