Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Code in c# .NET please. 1. Create C# solution named: yourFullName.For Example: MikeJoe Project name: Question1 Question 1 [5 marks]: Write a program that combine
Code in c# .NET please.
1. Create C\# solution named: "yourFullName".For Example: "MikeJoe" Project name: Question1 Question 1 [5 marks]: Write a program that combine all these instructions:- 1. Define an enumeration type named Sports whose values are defined by the following members: Skibobbing, Cycling, Hiking, Swimming. 2. Declare two variables s1 and s2 of Sports type and assign them a value 3. Convert s1 to an integer value and display the result. 4. Declare s3 of Colors type, combine Hiking, Swimming and Cycling members and assign them to s3 5. Display s3 "End of Question 1" In this question, you are going to add two classes: Department and Emplyee as described in UML Diagram: 1. Add a new class named Department Fields: - id: private field, represent the id of the department - name: private string represents the name of the department Properties All the properties have public getter and setters - Id: represents the id of the department - Name: represents the name of an department Constructor \& Methods - Department (.....)This constructor assigns the arguments to the appropriate fields. - ToString() :This is a public method overrides the corresponding method in the object class to return: id and the name of the department 2. Add a new class named Employee Fields: - Id: private field, represent the id of the employee - name: private string represents the name of the employee - salary: private double represents the annual salary of the employee - department: private field, represents the object of Department class Properties: All the properties have public getter and setters - Id: represents the id the employee - Name: represents the name of an employee - Salary: represents the annual salary. The salary of an employee should be less than $100000. - Department: represents Departemnt object. Constructos \& Methods: - Employee() - This is a default constructor - Employee(string id, string name, double salary, Departement department)This constructor assigns the arguments to the appropriate fields. - ToString() :This is a public method overrides the corresponding method in the object class to return: id and the name of the department 2. Add a new class named Employee Fields: - Id: private field, represent the id of the employee - name: private string represents the name of the employee - salary: private double represents the annual salary of the employee - department: private field, represents the object of Department class Properties: All the properties have public getter and setters - Id: represents the id the employee - Name: represents the name of an employee - Salary: represents the annual salary. The salary of an employee should be less than $100000. - Department: represents Departemnt object. Constructos \& Methods: - Employee() - This is a default constructor - Employee(string id, string name, double salary, Departement department)This constructor assigns the arguments to the appropriate fields. ToString() :This is a public method overrides the corresponding method in the object class to return: id, name, salary and department of the employee Part 3 [7 marks] The following instructions should be implemented in test class (that class that contains main method) n main method: 1. Create an object of Department class, named dept with the following properties: Name: " information technology", Id: "IT" 2. Create two objects of Employee class with different details:name, id and salary of your choice. The two employees work in the IT department. 3. Create a List of Employee Type named employees 4. Add the two created objects to this list. 5. Using a loop, print out all the items of the List. 6. Consider dept object you created in question 1. Write a code that save the data of this object into a file using serialization in binary formatStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started