الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

مشروع نهاية الفصل الدراسي

بدأه Zaianb في 11 يناير 2010 · 1 رد · 631 مشاهدة · في Microsoft Visual C#.NET
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

The Class

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;


namespace ConsoleApplication1
{
    class Class1
    {
        private string employeeName = "";
        public double workedHours = 0;
        public int workedMonths = 0;
        public double avg = 0;
        public int sum = 0;


        public string getName()
        {
            return employeeName;
        }

        public void setName(string value)
        {
            employeeName = value;

        }
        public double getworkedHours()
        {
            return workedHours;
        }

        public void setworkedHours(double workedHours)
        {

                this.workedHours = workedHours;
        }
        public int getworkedMonths()
        {
            return workedMonths;
        }
        public void setworkedMonths(int month)
        {
            month = workedMonths;
        }
        public double getAvg()
        {
            return avg;
        }

        public void setAvg(int workedHoursAvg)
        {
            int[] workedHours = new int[9240];

            for (int count = 0; count < workedHours.Length; count++)
            {

                sum += count;
                avg = sum / count;
            }
        }

    }
}

the program

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;


namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int employeesMonths = 0;

            employeeName[] Employees = new employeeName[25];
            for (int i = 0; i < Employees.Length; i++)
                Employees = new employeeName();
            for (int index = 0; index < Employees.Length; index++)
            {
                Console.Write("Enter your name: ");
                Employees[index].setName(Console.ReadLine());
                Console.Write("Enter your worked hours: ");
                Employees[index].setworkedHours(Console.ReadLine());
                Console.Write(" inter your worked months: ");
                workedMonths[index].setWorkedMonths(Console.ReadLine());


            }



            Console.ReadLine();


        }
    }
}

هذا مشروع مادة

c#

مطلوب منا عمل برنامج يوضح اسم الموظف و ساعات العمل و الشهور و ايجاد معدل ساعات العمل في كل شهر ل 25 موظف.

المشكلة :

يظهر لنا اخطاء في البرنامج ولا نستطيع حلها و هي ان البرنامج يظهر ان employeeName و workedHours الموجودين في البرنامج .. غير معرفين في البرنامج و لكننا قمنا بتعريفهم في ال class و لم نستطع ايضا ايجاد معدل الساعات في كل شهر مع اننا قمنا بكتابة الجملة التي تقوم بحساب المعدل في ال class

فأرجو منكم مساعدتنا .. مع العلم ان تسليم هذا المشروع الاسبوع القادم

شكرا جزيلا ..

#2

لاحظي جيدا انك قمت بتعريف employeeName على انه string و لكنك تعاملت معه على انه صنف.

قومي باعادة تسمية Class1 الى Employee و غيري ما يلائمها في البرنامجين

اذا كنت ستتعاملين مع عدد غير محدد من العمال فتجنبي ان تعرفي employeeName على انه جدول و استعملي ArrayList احسن

العمل كثير و الوقت قليل أعاننا الله

seo zen SEO Enlightment amazon danbo

مواضيع مشابهة