Sunday, June 21, 2020

#25 This program is in C# Create a class object called...

This program is in C# Create a class object called - Computer Science

ChemistryExplain daily providing Q&A content “#25 This program is in C# Create a class object called" in Computer science, Ba computer science, Berkeley computer science, Computer science associate degree jobs
Get the Free Online Chemistry Q&A Questions And Answers with explain. To crack any examinations and Interview tests these Chemistry Questions And Answers are very useful. Here we have uploaded the Free Online Chemistry Questions. Here we are also given the all chemistry topic.
 ChemistryExplain team has covered all Topics related to inorganic, organic, physical chemistry, and others So, Prepare these Chemistry Questions and Answers with Explanation Pdf.
For More Chegg Questions

Free Chegg Question

This program is in C#
 Create a class object called “Employee” which includes the following variables:
 firstName
 lastName
 idNumber
 initialSalary
 startedYear
 currentSalary
 yearlyIncrease: a static variable and initialize to 5%
 Methods:
 -Constructors
 -Properties (curSalary is a read-only).
 -CalcCurSalary():Calculate the present salary supported a 5% yearly increment from the startYear.
 Create an “EmployeeDemo” class. It includes three functions:
 In the main function, the program calls the readData() function to get the data from the file and calls the objSort() function to sort the array of objects. Then, the program prompts user to enter the range of current salary that user want to ascertain and display the employee’s information whose current salary is within the range in a descending order.
 readData(): this function reads the employee information from the “EmployeeInfo.txt” file (the total number of employees is the first number in the file) and creates a dynamic array to save the data. Then, it prompts user to enter the current year to calculate the currentSalary
 objSort(): this function accepts an array of object as a parameter and type the array by current salary in descending order.
 (employeeinfo.txt) – below is what the txt file contains
 Anna
 Alaniz
 A001232
 2001
 31500
 Lydia
 Bean
 A001233
 2002
 50000
 Hector
 For More Chemistry Notes and Helpful Content Subscribe Our YouTube Chanel - Chemistry Explain  

Free Chegg Answer

Code:-
 using System;
 using System.IO;
 namespace EmployeeInfo
 {
 //Class that holds employee data
 class Employee
 {
 //Private variables
 private String firstName;
 private String lastName;
 private String idNumber;
 private int startYear;
 private double initialSalary;
 private double currentSalary;
 //Constructor to assign values
 public Employee(String fname, String lname, String idNum, int startYr, double initSalary)
 {
 firstName = fname;
 lastName = lname;
 idNumber = idNum;
 startYear = startYr;
 initialSalary = initSalary;
 currentSalary = initSalary;
 }
 //Accessor methods
 public String getFirstName()
 {
 return firstName;
 }
 public String getLastName()
 {
 return lastName;
 }
 public String getIdNumber()
 {
 return idNumber;
 }
 public int getStartYear()
 {
 return startYear;
 }
 public double getInitialSalary()
 {
 return initialSalary;
 }
 public double getCurrentSalary()
 {
 return currentSalary;
 }
 //Mutator methods
 public void setFirstName(String fname)
 {
 firstName = fname;
 }
 public void setLastName(String lname)
 {
 lastName = lname;
 }
 public void setIdNumber(String idNum)
 {
 idNumber = idNum;
 }
 public void setStartYear(int startYr)
 {
 startYear = startYr;
 }
 public void setInitialSalary(double initSalary)
 {
 initialSalary = initSalary;
 }

Labels: , ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home