Need help writing the following program, on the output \"number of employees\" i
ID: 3779103 • Letter: N
Question
Need help writing the following program, on the output "number of employees" is the count for department. So if I enter 01 as the department 3 times that would be the output for employees. It needs to use switch statements, cannot use arrays. Language is C#
CIS112 Assignment #4 A sales company has many employees. Each employee works in a specific department. The departments are located in areas and the areas are contained inside territories. Your manager has asked you to write an interactive program to allow the salesperson to enter the territory, the area and the department they are in whenever they make a sale. The territories are numbered from 01 thru 03, the areas are also numbered from 01 thru 03 and the departments are numbered from 01-10. If the territory is 99, stop the program. The manager wants totals for the number of sales in each department with the following form: Terr 01 Area 01 Number of Employees Department 016 02 5 Area -02 Number of Employees Department 015 027 Terr-03 Area -01 Number of Employees Department 012 05Explanation / Answer
**************************program**********************************
using System;
namespace DecisionMaking
{
class Program
{
static void Main(string[] args)
{
int Terr=0;
int areaNo=0;
int a1Emp=0;
int a2Emp=0;
int deptNo=0;
Console.WriteLine("Please enter your territory:");
Terr = Convert.ToInt32(Console.ReadLine());
if(Terr==01){
switch(Terr) {
case 01 :
Console.WriteLine("Please enter your area number and department no:");
areaNo = Convert.ToInt32(Console.ReadLine());
deptNo = Convert.ToInt32(Console.ReadLine());
if(areaNo ==01 && deptNo==01)
{a1Emp++;
Console.WriteLine("a1Emp:{0}:",a1Emp);
}
else if(areaNo ==02 && deptNo==02)
a2Emp++;
break;
case 02 :
Console.WriteLine("Please enter your area number and department no:");
areaNo = Convert.ToInt32(Console.ReadLine());
deptNo = Convert.ToInt32(Console.ReadLine());
if(areaNo ==01 && deptNo==01)
a1Emp++;
else if(areaNo ==02 && deptNo==02)
a2Emp++;
break;
}
}
else if(Terr==03){
switch(Terr) {
case 01 :
Console.WriteLine("Please enter your area number and department no:");
areaNo = Convert.ToInt32(Console.ReadLine());
deptNo = Convert.ToInt32(Console.ReadLine());
if(areaNo ==01 && deptNo==01)
a1Emp++;
else if(areaNo ==05 && deptNo==02)
a2Emp++;
break;
}
}
Console.WriteLine("Number of Employees in area1 are {0}:",a1Emp);
Console.WriteLine("Number of Employees in area2 are {0}:",a2Emp);
Console.ReadLine();
}
}
}
***********************output**************************************
Please enter your territory:
01
Please enter your area number and department no:
01
01
a1Emp:1:
Number of Employees in area1 are 1:
Number of Employees in area2 are 0:
*****************************************************************************
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.