Question

Complete each of the following exercises from the Deitel book, using the indicated C# project names....

Complete each of the following exercises from the Deitel book, using the indicated C# project names. You should use a .NET Framework Console application type for each project. All projects should be part of a single solution named: Cs2Apps.

How to setup multiple Projects in one Visual Studio Solution

When creating the first Project, make sure to uncheck the box for putting the solution and the project in the same folder. This will create a separate folder with the solution file by itself and the first project in a folder under that. For each subsequent project, use the "File->Add->New Project" to add each project to the **same** solution.

To switch projects among those listed in the Solution Explorer window, right click on the project and select "Set as StartUp Project". The selected startup project will display as bold text in the Solution Explorer window.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4.11 - Employee Class (Project Name: EmployeeDB) -
Create a class called Employee that includes three pieces of information as either instance variables or auto-implemented properties - first name (type string), last name (type string) and a monthly salary (decimal). Your class should have a constructor that initializes the three values. Provide a property with a get and set block for any instance variables. If the monthly salary is negative, the set block should leave the instance variable unchanged. Write a test driver program for Employee that demonstrates the Employee class capabilities (use Program.cs for this). Create 3 Employee objects and display each object’s yearly salary. Then give each Employee a 10% raise and display each Employee’s yearly salary again.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6.16 - Displaying a Bar Chart (Project Name: BarChart) -
One interesting application of computers is to display graphs and bar charts. Write an app that reads three numbers between 1 and 30. For each number that’s read, your app should display the same number of adjacent asterisks. For example, if your app reads the number 7, it should display 7 stars: *******

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Dear Student ,

As per requirement submitted above kindly find below solution.

4.11 - Employee Class (Project Name: EmployeeDB)

Here new console application in C# is created using visual studio 2019 with name "EmployeeDB". This application contains below classes.

Employee.cs :

//namespace
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//application namespace
namespace EmployeeDB
{
class Employee//C# class
{
//auto-implemented properties
public string firstName { get; set; }
public string lastName { get; set; }
private decimal salary;

//constructor
public Employee()
{
this.firstName = "";
this.lastName = "";
this.salary = 0;
}
//setter and getter method for salary
public decimal Salary
{
get
{
return salary;
}
set
{
//checking salary
if(value>0)
{
this.salary = value;
}
}
}

}
}
*********************************

Program.cs :

//namespace
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//application namespace
namespace EmployeeDB
{
class Program //C# class
{
//Main() method , which is entry point of the application
static void Main(string[] args)
{
//creating object of Employee class
Employee e1 = new Employee();
e1.firstName = "Virat";//set firstName
e1.lastName = "Kohli";//set lastName
e1.Salary = 10000;//set Salary
//print e1 details
Console.WriteLine("Employee 1 :" + e1.firstName + " " + e1.lastName +"\n\tYearly salary : "+(e1.Salary*12));
//creating object of Employee class
Employee e2 = new Employee();
e2.firstName = "KL";//set firstName
e2.lastName = "Rahul";//set lastName
e2.Salary = -10000;//set Salary
//print e2 details
Console.WriteLine("Employee 2 :" + e2.firstName + " " + e2.lastName + "\n\tYearly salary : " + (e2.Salary * 12));
//creating object of Employee class
Employee e3 = new Employee();
e3.firstName = "Ajinkya";//set firstName
e3.lastName = "Rahane";//set lastName
e3.Salary = 5000;//set Salary
//print e3 details
Console.WriteLine("Employee 3 :" + e3.firstName + " " + e3.lastName + "\n\tYearly salary : " + (e3.Salary * 12));
Console.WriteLine("---------Employee details after giving 10% salary hike----------");
//print e1 details
decimal e1Salary= (e1.Salary * 12) * (decimal)0.10;//calculating yearly 10% increment
Console.WriteLine("Employee 1 :" + e1.firstName + " " + e1.lastName + "\n\tYearly salary : " + (e1Salary + (e1.Salary * 12)));
//print e2 details
decimal e2Salary = (e2.Salary * 12) * (decimal)0.10;//calculating yearly 10% increment
Console.WriteLine("Employee 2 :" + e2.firstName + " " + e2.lastName + "\n\tYearly salary : " + (e2Salary + (e2.Salary * 12)));
//print e3 details
decimal e3Salary = (e3.Salary * 12) * (decimal)0.10;//calculating yearly 10% increment
Console.WriteLine("Employee 3 :" + e3.firstName + " " + e3.lastName + "\n\tYearly salary : " + (e3Salary + (e3.Salary * 12)));
//used to hold the screen
Console.ReadKey();
}
}
}

==================================

Output :Run application using F5 and will get the screen as shown below

Screen 1:Program.cs

NOTE :PLEASE FEEL FREE TO PROVIDE FEEDBACK ABOUT THE SOLUTION.

Add a comment
Know the answer?
Add Answer to:
Complete each of the following exercises from the Deitel book, using the indicated C# project names....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Instructions: Refer to the Timel class provided in Figure 8.1 in your Deitel book to complete...

    Instructions: Refer to the Timel class provided in Figure 8.1 in your Deitel book to complete the exercise. Make sure that you follow the Program Style and Readability guidelines found in the Start Here Folder. 1. Write a Point class. The Point class should be written as an abstract data type. 2. Include the following instance variables: a. an integer representing the x coordinate b. an integer representing the y coordinate c. The instance variables in your program should only...

  • Create another Java class named EmployeeMain within the same project, which includes the main method. a....

    Create another Java class named EmployeeMain within the same project, which includes the main method. a. Include another class named Employee in the same Java file. This class has the following instance variables and instance methods. Define all the instance/static variables with private access modifier and constructors, instance/static methods with public access modifier. Instance Variables empID: int employeeName: String basicSalary: double Constructor Set the value for empID. Instance Methods Get and set methods for all instance variables. displayEmployee: Display the...

  • create java application with the following specifications: -create an employee class with the following attibutes: name...

    create java application with the following specifications: -create an employee class with the following attibutes: name and salary -add constuctor with arguments to initialize the attributes to valid values -write corresponding get and set methods for the attributes -add a method in Employee called verify() that returns true/false and validates that the salary falls in range1,000.00-99,999.99 Add a test application class to allow the user to enter employee information and display output: -using input(either scanner or jOption), allow user to...

  • In one file create an Employee class as per the following specifications: three private instance variables:...

    In one file create an Employee class as per the following specifications: three private instance variables: name (String), startingSalary (int), yearlyIncrement (int) a single constructor with three arguments: the name, the starting salary, and the yearly increment. In the constructor, initialize the instance variables with the provided values. get and set methods for each of the instance variables. A computation method, computeCurrentSalary, that takes the number of years in service as its argument. The method returns the current salary using...

  • E2a: Create a class called Employee that includes three pieces of information as data members---a first...

    E2a: Create a class called Employee that includes three pieces of information as data members---a first name (char array), last name (char array) and a monthly salary (integer). Your class should have a constructor that initializes the three data members. If the monthly salary is not positive, set it to 0. Write a test program that demonstrates class Employee’s capabilities. Create two Employee objects and display each object’s yearly salary. Then give each Employee a 10 percent raise and display...

  • Complete Project 4-1 as outlined above. There are no starter files for this project. You will...

    Complete Project 4-1 as outlined above. There are no starter files for this project. You will make it from scratch. You should end up with 5 files in your package (.settings, bin, src, .classpath, and .project) Console Welcome to the Customer Viewer Enter a customer number: 1003 Ronda Chavan 518 Commanche Dr. Greensboro, NC 27410 Display another customer? (y/n): Y Enter a customer number: 2439 There is no customer number 2439 in our records. Display another customer? (y/n): n Operation...

  • help please Perform the following steps: a) Using NetBeans, Create a New Java Application Project with...

    help please Perform the following steps: a) Using NetBeans, Create a New Java Application Project with Project Name BasePlusCommission Employee Test with Create Main Class check box selected. Create comments to form a descriptive header that has the course name, your name, the assignment title, and a pledge that you have neither received nor provided help to any person. Assignments submitted without this pledge will not be graded. When you have completed the steps (b) and (c) below, you will...

  • Create a C++ project Create an Employee class using a separate header file and implementation file....

    Create a C++ project Create an Employee class using a separate header file and implementation file. The calculatePay() method should return 0.0f. The toString() method should return the attribute values ("state of the object"). Create an Hourly class using a separate header file and implementation file. The Hourly class needs to inherit from the Employee class The calculatePay() method should return the pay based on the number of hours worked and the pay rate. Remember to calculate overtime! Create a...

  • JAVA... QUESTION 3 IS A CONTINOUS TO Q2 CAN YOU SEND THE CODE SEPARATELY FOR EACH...

    JAVA... QUESTION 3 IS A CONTINOUS TO Q2 CAN YOU SEND THE CODE SEPARATELY FOR EACH Q , I BE SO THANKFUL Q2. Implement a program to store the applicant’s information for a visa office. You need to implement the following: A super class called Applicant, which has the following instance variables: A variable to store first name of type String. A variable to store last name of type String. A variable to store date of birth, should be implemented...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT