An employee program:
Accept details from user: like,
empcode
empname
dob
bloodgroup
location
netsalary
find out how many employees have a specific blood group. accept blood group from user and display.
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Joginder BangerPosted Nov 15, 2014, 12:16 AM
public class Info
{
public int empcode { get; set; }
public string empname { get; set; }
public string dob { get; set; }
public string dept { get; set; }
public string bloodgroup { get; set; }
}
public class program
{
// empcode,empname,dob,dept,bloodgroup
static void Main(string[] args)
{
Info _information= new Info() {empcode=101,empname="testing",dob="24 march",dept="IT",bloodgroup="A++"};
Info _informatio1= new Info() {empcode=102,empname="testing1",dob="24 march",dept="IT1",bloodgroup="B++"};
Info _informatio2= new Info() {empcode=103,empname="testing2",dob="24 march",dept="IT2",bloodgroup="A++"};
Info _informatio3= new Info() {empcode=104,empname="testing3",dob="24 march",dept="IT3",bloodgroup="B++"};
List
infolist.Add(_information);
infolist.Add(_informatio1);
infolist.Add(_informatio2);
infolist.Add(_informatio3);
var tempvalue = from aa in infolist where aa.bloodgroup == "A++" select new {empcode=aa.empcode,Name=aa.empname,DOB=aa.dob,Deprtment=aa.dept,BlooodGroup=aa.bloodgroup };
foreach (var item in tempvalue)
{
Console.WriteLine(item.Name);
}
}
}
output is: testing and testing2
check online code
https://dotnetfiddle.net/T3GUkZ
Joginder BangerPosted Nov 15, 2014, 1:52 AM
Srinivasan JayaramanPosted Nov 15, 2014, 1:38 AM
Joginder BangerPosted Nov 15, 2014, 1:04 AM
Srinivasan JayaramanPosted Nov 15, 2014, 1:02 AM
getting dob from user as input and we should convert it into age as output.
Joginder BangerPosted Nov 15, 2014, 1:01 AM
Srinivasan JayaramanPosted Nov 15, 2014, 12:57 AM
Srinivasan JayaramanPosted Nov 14, 2014, 9:05 PM
input from user: empcode,empname,dob,dept,bloodgroup
output: the output must be find out who have the similar blood groups among all the employees
example:
empname blodgroup
john a+
peter b-
david b-
now,
the output should be "peter and david has same b- blood group" like this i need.
note: in this program there is no backend at all just use simple c sharp program.
Riddhi ValechaPosted Nov 14, 2014, 3:34 AM
Your back-end is SQL Server ??
I think your project is all of Insert, Update, and Select queries.
Joginder BangerPosted Nov 14, 2014, 3:29 AM
May be your problem is good but i can't understand what's you want.
if you want count the employee have a specific group like A++
select count(employee_code) from table_name where bloodGroup='A++'