Question
C# Assignment ( class and objects ) Exercise: a) [15 marks] - Write a C# application using VS 2017 as IDE, that implements the following
C# Assignment ( class and objects )
Exercise: a) [15 marks] - Write a C# application using VS 2017 as IDE, that implements the following class as per business requirements mentioned below:
Create an Employee class (Employee.cs) that has the following UML class diagram:
Employee Class
Fields
employeeId : int
Properties
EmployeeId : int readonly
FirstName : string
LastName : string
BaseSalary : double
GrossSales : double
ComissionRate : double
Methods
Earnings() : double
constructor Employee()
constructor Employee(employeeID : int, firstName : string, baseSalary : double)
Employee ID, first name, last name, base salary, gross sales (amount in dollars) and commission rate. Define their data types appropriately. Define read only property for employee ID.
Use default value of 1000.00 dollars for base salary for all the employees.
Commission rate should be set by default to 0.1.
Class should have defined two overloaded constructors: o One, without parameters, for initializing all the instance data members o Second for initializing employee ID, first name, base salary only.
Define a public method called earnings which calculates employees commission ( commission rate * gross sales + base salary )
b) [15 marks] Rename Program class to EmployeeTest. In the Main() method of the EmployeeTest class, create two objects of the type Employee. Each to demonstrate the use of a different constructor that has been created
For the second object, ask the user to enter first name, last name, base salary, gross sales and commission rate.
After the user enters all information, the application will calculate Earnings and display it formatted as currency. Gross sales and commission rate should never be negative or zero. You need check and validate that the user is entering an acceptable value.
Commission rate should be between 0.1% and 1.0%. You need check and validate that the user is entering an acceptable value. Aspects that will be evaluated: Proper identifier casing
Correct implementation of classes (instance variable declarations, constructors, getter and setter methods)
Declaring and creating objects, calling their methods, interacting with user, displaying results
Comments, correct naming of variables, methods, classes Friendly input/output
Step 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