Problem Scenario
Specification and Task
Using Microsoft Visual Studio and C#.net, Create windows application and write appropriate code for both activities 1 and 2. Activity1 is about array and text file and Activity2 is aggregation, inheritance and polymorphism. Use editor provided debugging tools to resolve syntax and logic Error. After completing each step, test the program and confirm code meet the program requirements. Write a short note for test performed and achieved result. Submit that document with the assessment. For the coding, consider the layout, C# naming & commenting conventions and write internal comments as well.
Activity 1
1) Design a form in a windows application. The Forms control specifications are as follows
Control |
Name |
Property |
Value |
Form |
Form1 |
Text |
Employee Information |
|
|
StartupPosition |
CenterScreen |
Label |
Labe11 |
name |
NameLabel |
|
|
Text |
Name |
ComboBox |
ComboBox 1 |
name |
NameComboBox |
Button |
Button1 |
name |
ExitButton |
|
|
Text |
Exit |
Label |
Label2 |
name |
LabelSalary |
|
|
Text |
Salary |
Label |
Label3 |
name |
LabelHighestSalary |
|
|
Text |
Highest Salary |
Button |
Button2 |
name |
SummaryButton |
|
|
Text |
Summary |
2) Write a function to read following employee name from employee.txt file and store into array. Employee's Personal information3) Display the employee name in a combo box from the array.
4) Create an array to store employee's salary from above Employee's Personal Information.
5) Display the salary of selected employee from combo box.
6) Create a function/method to find highest salary. Display the employee name and amount.
7) Store the employee's name and salary in a text file "Salary.text" who earns more than $6000 and less than $10000
Activity 2
Create a windows application and follow each steps sequentially to implements following shapes hierarchy and draw a class diagram for them.
Employee Name |
Title |
Salary |
Kavin |
Manager |
4500 |
John |
Clerk |
5400 |
Bob |
Analyst |
5750 |
Magi |
Programmer |
6140 |
David |
Accountant |
6355 |
Klren |
DBA |
6620 |
Roulf |
Accountant |
7130 |
Alan |
Manager |
8000 |
Paulo |
Analyst |
8090 |
Maget |
Analyst |
9000 |
Step1 Classes
Shapes: Shapes has "height" and "width" instance variables of type double. 2DShapes: Create a derived class of the shapes class for 2DShapes.
Triangle: Triangle is a derived class of 2DShapes. It has an instance for a string field "style'. Rectangle: Rectangle is a derived class of
2DShapes. It has an instance for a string field "style'.
3DShapes: 3DShapes is a derived class of the shape. 3DShapes has a double type instance variable radius. Sphere: Sphere is a derived class of 3DShapes. Create an instance for a string field "style".
Cube: Create a derived class of 3DShapes for Cube. Cube has a string type field style.
Step2. Constructor
Shapes: Two constructors- one is null and another one with two double type parameter 'height' and
2DShapes: Two constructors- one is null and another one with two double type parameters height and width. For both call the base constructor.
3DShapes: Two constructors- one is null and another one with three double type parameter 'height', 'width' and 'radius'. For both call the base constructor.
Triangle: Two constructors- One is null and another one with four parameters string 'style' , double 'height', 'width' and 'radius'. Call the base constructor. Style= style + ": A triangle is one of the basic shapes of Geometry: a polygon with three corners\ n" + "or vertices and three sides or edges which are line segments.";
Rectangle: Two constructors- One is null and another one with four parameter string 'style' , Double 'height', 'width'. Call the base constructor. Style= style + ": A Ractangle (geometry) is a polygon with two equal length, hight and angles.";
Cube: Two constructors- One is null and another one with four parameter (string 'style', double 'height', 'width' and 'radius'. Call the base constructor. Style= style + ": a cube is a three-dimensional solid object bounded by six square \ n" + "faces, facets or sides, with three meeting at each vertex.";
Sphere: Two constructors- One is null and another one with four parameter string 'style' , Double 'height', 'width' and 'radius'. Call the base constructor. Style= style + ": A Sphare is a perfectly round geometrical object in three dimensional space.";
Step3. Methods
Shapes: Public virtual method Area() and return the area. Note- (area=height*width).
2DShapes: Public virtual method Volume() and return the volume. Note-(volume=height*width). 3DShapes: Public virtual method Volume() and return the volume. Note-(volume=height-width*radius). Triangle: Three public method
i) Area() will return area,
ii) Volume() will return volume.
iii) Show description() will return style.
Note- Area () and Volume () will override their base method. Hint- (volume=1/29 Width * height )), (area=Widthsheight/2).
Rectangle: Public method Show description() will return style. Cube: Three public method
ii) Volume() will return volume.
Pi) Show description() will return style.
Note- Area () and Volume () will override their base method.
Hint- ( volume = 4/3*( Math.PI*Math.Pow(Radious,3))), (Area=4 * Math.PI * Math.Pow(Radious,2)).
Sphere: Three public method
i) Area() will return area.
ii) Volume() will return volume.
iii) Show description() will return style.
Note- Area () and Volume () will override their base method.
Hint- (volume = 4/3 * (Math.PI*Math.Pow(Radious,3))), (area=4 * Math.PI * Math.Pow(Radious,2)).
Step4. Graphical User Interface (GUI)
Read height, Width and Length/Radius for Triangle, Rectangle, Cube, Sphere and show their area, volume and description.
Testing:
Create and conduct simple tests to ensure both applications meet given specifications. Document the tests performed and result.