Saturday, September 21, 2013

Course Registration & Fee Calculator Forms Code Written By Muhammad Junaid Akram

Task
Write a program in which we are registering course of student and then calculate their fees according to registered course and give fees concession for naval person.

Helping Class.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Collections;

namespace CourseRegistrationTask1lab1
{
    public class HelpingClass
    {
        public static List<string> RegisteredSemesterCoursesList = new List<string>();
        public static List<string> CurrentSemesterCoursesList = new List<string>();
        #region DisplayRegisteredCoursesOnRegisteredCoursesListBox
        public void
            DisplayRegisteredCoursesOnRegisteredCoursesListBox(ListBox RegisteredCoursesListBox)
        {
            foreach (var item in RegisteredSemesterCoursesList)
            {
                RegisteredCoursesListBox.Items.Add(item);

            }
        }
        #endregion
        #region ClearLists
        public void empty()
        {
            CurrentSemesterCoursesList.Clear();
        }
        #endregion
        #region ShowingCurrentSemesterCourse
        public List<string> ShowingCurrentSemesterCourse(int CurrentSemesterNo)
        {
            switch (CurrentSemesterNo)
            {
                case 1:
                    {

                        CurrentSemesterCoursesList.Add("Computing Fundamentals");
                        CurrentSemesterCoursesList.Add("Computing Fundamentals Lab");
                        CurrentSemesterCoursesList.Add("Computer Programming");
                        CurrentSemesterCoursesList.Add("Computer Programming Lab");
                        CurrentSemesterCoursesList.Add("Applied Calculus & Analytical Geometry");
                        CurrentSemesterCoursesList.Add("Applied Physics");
                        CurrentSemesterCoursesList.Add("Applied Physics Lab");
                        CurrentSemesterCoursesList.Add("Functional English");
                        CurrentSemesterCoursesList.Add("Islamic Studies");
                        return CurrentSemesterCoursesList;

                    }
                case 2:
                    {


                        CurrentSemesterCoursesList.Add("Discrete Structures-I ");
                        CurrentSemesterCoursesList.Add("Object Oriented Programming");
                        CurrentSemesterCoursesList.Add("object Oriented Programming Lab");
                        CurrentSemesterCoursesList.Add("Basic Electronics");
                        CurrentSemesterCoursesList.Add("Basic Electronics Lab");
                        CurrentSemesterCoursesList.Add("Principles of Management");
                        CurrentSemesterCoursesList.Add("Communication Skills");
                        CurrentSemesterCoursesList.Add("Pakistan Studies");
                        return CurrentSemesterCoursesList;
                    }
                case 3:
                    {
                        CurrentSemesterCoursesList.Add("Introduction to Software Engineering");
                        CurrentSemesterCoursesList.Add("Data Structures & Algorithms");
                        CurrentSemesterCoursesList.Add("Data Structures & Algorithms Lab");
                        CurrentSemesterCoursesList.Add("Computer Programming Lab");
                        CurrentSemesterCoursesList.Add("Digital Logic Design");
                        CurrentSemesterCoursesList.Add("Linear Algebra");
                        CurrentSemesterCoursesList.Add("Software Construction");
                        CurrentSemesterCoursesList.Add("Software Construction Lab");
                        return CurrentSemesterCoursesList;

                    }
                case 4:
                    {           
        CurrentSemesterCoursesList.Add("Operating Systems");
                        CurrentSemesterCoursesList.Add("Database Management Systems");
                        CurrentSemesterCoursesList.Add("Database Management Systems Lab");
                        CurrentSemesterCoursesList.Add("Tech. Writing & Present. Skill");
                        CurrentSemesterCoursesList.Add("Supporting Elective II");
                        CurrentSemesterCoursesList.Add("GE/University Elective II");
                        return CurrentSemesterCoursesList;
                     }
                case 5:
                    {
                        CurrentSemesterCoursesList.Add("Software Requirements Engineering");
                        CurrentSemesterCoursesList.Add("Software Requirements Engineering Lab");
                        CurrentSemesterCoursesList.Add("Prob. and Statistics for Engineers");
                        CurrentSemesterCoursesList.Add("Data Communication & Networking");
                        CurrentSemesterCoursesList.Add("Data Communication & Networking Lab");
                        CurrentSemesterCoursesList.Add("SE Elective I");
                        CurrentSemesterCoursesList.Add("Supporting Elective III");
                        CurrentSemesterCoursesList.Add("GE/University Elective III");
                       return CurrentSemesterCoursesList;
                     }
                case 6:
                    {
                        CurrentSemesterCoursesList.Add("Human Computer Interaction");
                        CurrentSemesterCoursesList.Add("Software Quality Engineering");
                        CurrentSemesterCoursesList.Add("Software Design & Architecture");
                        CurrentSemesterCoursesList.Add("Software Design & Architecture Lab");
                        CurrentSemesterCoursesList.Add("Formal Methods in Software Engineering");
                        CurrentSemesterCoursesList.Add("SE Elective II");
                        CurrentSemesterCoursesList.Add("SE Application Domain Elective –I");
                        return CurrentSemesterCoursesList;
                     }
                case 7:
                    {


                        CurrentSemesterCoursesList.Add("Project I");
                        CurrentSemesterCoursesList.Add("Software Project Management");
                        CurrentSemesterCoursesList.Add("Engineering Ethics");
                        CurrentSemesterCoursesList.Add("SE Application Domain Elective –II");
                        CurrentSemesterCoursesList.Add("GE/University Elective IV");
                        return CurrentSemesterCoursesList;
                         }
                case 8:
                    {
                        CurrentSemesterCoursesList.Add("Project II");
                        CurrentSemesterCoursesList.Add("SE Elective III");
                        CurrentSemesterCoursesList.Add("SE Elective IV");
                        CurrentSemesterCoursesList.Add("  SE Elective V");
                        return CurrentSemesterCoursesList;
                    }
                default:
                    return CurrentSemesterCoursesList;
            }
                  }
        #endregion
        #region ProgrammeComboBoxFilling
        public ComboBox ProgrammeComboBoxFilling(string Department, ComboBox combo)
        {
            if (Department == "Engineering")
            {
                combo.Items.Clear();
                combo.Items.Add("BSE");
                combo.Items.Add("BEE");
                return combo;
            }
            if (Department == "Mangement")
            {
                combo.Items.Clear();
                combo.Items.Add("BBA");
                combo.Items.Add("MBA");
                return combo;
            }
            return combo;
        }
        #endregion
        #region SemesterNoOffered
        public ComboBox SemesterNoOffered(string Programme, ComboBox combo)
        {
            switch (Programme)
            {
                case "BBA":
                    {
                        return Loop(9, combo);

                    }
                case "MBA":
                    {
                        return Loop(5, combo);

                    }
                case "BSE":
                    {
                        return Loop(9, combo);

                    }
                case "BEE":
                    {
                        return Loop(9, combo);

                    }
                default:
                    return combo;
            }
         }
        #endregion
        #region Loop
        private ComboBox Loop(int length, ComboBox combo)
        {
            combo.Items.Clear();
            for (int i = 1; i < length; i++)
            {
            combo.Items.Add(i);
            }
            return combo;
        }
        #endregion
        #region RemoveItemFromRegisteredSemesterCoursesList
        public void RemoveItemFromList(string value)
        {
            RegisteredSemesterCoursesList.Remove(value);
        }
        #endregion
        #region Calculation
        public void Calculataion(RadioButton NavalradioButton, RadioButton SiblingradioButton, RadioButton CivilianradioButton)
        {
            if (RegisteredSemesterCoursesList.Count > 9)
            {
                MessageBox.Show("You are overlimiting from 18 credit hour!!");
            }
            else
            {
                int TotalCourses = RegisteredSemesterCoursesList.Count;
                double TotalFees;
                double discount;
                if (NavalradioButton.Checked == true)
                {
                   TotalFees = (TotalCourses * 3000);
                    discount = TotalFees * 0.25;
                    TotalFees = TotalFees - discount;
                    ShowingRecord.TotalFees = TotalFees;
                    ShowingRecord.Type = "naval";
                    if (SiblingradioButton.Checked == true)
                    {
                        TotalFees = TotalFees - discount;
                        ShowingRecord.TotalFees = TotalFees;
                        ShowingRecord.Sibling = "Sibling";

                    }
                    else
                    {
                        ShowingRecord.TotalFees = TotalFees;
                        ShowingRecord.Sibling = "none";

                    }
                 }
                else if (CivilianradioButton.Checked == true)
                {
                    ShowingRecord.Type = "naval";
                    TotalFees = (TotalCourses * 60000);
                    if (SiblingradioButton.Checked == true)
                    {
                        ShowingRecord.Sibling = "Sibling";
                        TotalFees = TotalFees - 750;
                        ShowingRecord.TotalFees = TotalFees;

                    }
                    else
                    {
                        ShowingRecord.TotalFees = TotalFees;
                        ShowingRecord.Sibling = "none";

                    }
                    }
            }
        #endregion
        }
    }
    public class ShowingRecord
    {
        public static string StudentName;
        public static int RegistrationId;
        public static string Semester;
        public static string Department;
        public static string Programme;
        public static double TotalFees;
        public static int TotalCourses;
        public static string Type;
        public static string Sibling = "none";
    }
}
Form1.cs:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Collections;

namespace CourseRegistrationTask1lab1
{
    public partial class Form1 : Form
    {
        private HelpingClass helpingClass;
        List<string> Helplist;
 
        public Form1()
        {
            InitializeComponent();
            helpingClass = new HelpingClass();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            DepartmentComboxbox.Items.Add("Engineering");
            DepartmentComboxbox.Items.Add("Mangement");
            CivilianradioButton.Checked = true;
            NoneradioButton.Checked = true;

        }
        private void DepartmentComboxbox_SelectedIndexChanged(object sender, EventArgs e)
        {
            ProgrammeCombobox.ResetText();
            string Department = DepartmentComboxbox.Text;
            helpingClass.ProgrammeComboBoxFilling(Department, ProgrammeCombobox);
        }
        private void ProgrammeCombobox_SelectedIndexChanged(object sender, EventArgs e)
        {
            SemesterOfferedCombobox.ResetText();
            string Programme  = ProgrammeCombobox.Text;
            helpingClass.SemesterNoOffered(Programme, SemesterOfferedCombobox);
        }
       private void RegisterAllbutton_Click(object sender, EventArgs e)
        {
            foreach (var item in Helplist)
            {
                HelpingClass.RegisteredSemesterCoursesList.Add(item);
            }
            helpingClass.DisplayRegisteredCoursesOnRegisteredCoursesListBox(RegisterCourseslistBox);
        }
       private void SemesterOfferedCombobox_SelectedIndexChanged(object sender, EventArgs e)
        {
       helpingClass.empty();
            OfferedCourseslistBox.Items.Clear();
            int CurrentSemester = Convert.ToInt32(SemesterOfferedCombobox.Text);
            Helplist = helpingClass.ShowingCurrentSemesterCourse(CurrentSemester);
            foreach (var item in Helplist)
            {
                OfferedCourseslistBox.Items.Add(item);
            } }

        private void RegisterSelectedbutton_Click(object sender, EventArgs e)
        {
            try
            {
                RegisterCourseslistBox.Items.Clear();
                HelpingClass.RegisteredSemesterCoursesList.Add(OfferedCourseslistBox.SelectedItem.ToString());

                helpingClass.DisplayRegisteredCoursesOnRegisteredCoursesListBox(RegisterCourseslistBox);
            }
            catch (Exception)
            { } }


       private void SemestercomboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
          
            if (SemestercomboBox.Text=="Spring" && ProgrammeCombobox.Text=="BSE"|| ProgrammeCombobox.Text =="BEE")
            {
                SemestercomboBox.ResetText();
                SemesterOfferedCombobox.Items.Clear();
                SemesterOfferedCombobox.Items.Add(2);
                SemesterOfferedCombobox.Items.Add(4);
                SemesterOfferedCombobox.Items.Add(6);
                SemesterOfferedCombobox.Items.Add(8);

            }
            if (SemestercomboBox.Text == "Fall" && ProgrammeCombobox.Text == "BSE" || ProgrammeCombobox.Text == "BEE")
            {
                SemestercomboBox.ResetText();
                SemesterOfferedCombobox.Items.Clear();
                SemesterOfferedCombobox.Items.Add(1);
                SemesterOfferedCombobox.Items.Add(3);
                SemesterOfferedCombobox.Items.Add(5);
                SemesterOfferedCombobox.Items.Add(7);

            }
        }

        private void Unregisterbutton_Click(object sender, EventArgs e)
        {
            try
            {
               HelpingClass.RegisteredSemesterCoursesList.Remove(RegisterCourseslistBox.SelectedItem.ToString());
                RegisterCourseslistBox.Items.Clear();
                helpingClass.DisplayRegisteredCoursesOnRegisteredCoursesListBox(RegisterCourseslistBox);
            }
            catch(Exception )
            {
                MessageBox.Show("Plz select course for unregister!!!");
            }
        }

        private void GenerateFeeSlipbutton_Click(object sender, EventArgs e)
        {
            helpingClass.Calculataion(NavalradioButton, SiblingradioButton, CivilianradioButton);
            Hide();
            FillRecordForShowingOnForm();
            ResultantForm obj = new ResultantForm();
            obj.Show();
        }
        public void FillRecordForShowingOnForm()
        {
            ShowingRecord.Department = DepartmentComboxbox.Text;
            ShowingRecord.Programme = ProgrammeCombobox.Text;
            ShowingRecord.RegistrationId = Convert.ToInt32(RegistrationIdTextBox.Text);
            ShowingRecord.Semester = CurrentSemesterTextBox.Text;
            ShowingRecord.StudentName = StudentNametextBox.Text;
        } } }

Resultant.cs:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace CourseRegistrationTask1lab1
{
    public partial class ResultantForm : Form
    {
      
        public ResultantForm()
        {
            InitializeComponent();
          
        }

        private void ResultantForm_Load(object sender, EventArgs e)
        {
            StudentNameLabel.Text = ShowingRecord.StudentName;
            RegistrationIdLabel.Text = Convert.ToString(ShowingRecord.RegistrationId);
            Semesterlabel.Text = ShowingRecord.Semester;
            Departmentlabel.Text = ShowingRecord.Department;
            Programmelabel.Text = ShowingRecord.Programme;
            foreach (var item in HelpingClass.RegisteredSemesterCoursesList)
            {
                RegisterCourseslistBox.Items.Add(item);

            }
            TotalCourseslabel.Text =Convert.ToString( HelpingClass.RegisteredSemesterCoursesList.Count);
            TotalFeesLabel.Text = ShowingRecord.TotalFees.ToString();
            NavalLabel.Text = ShowingRecord.Type;
            SiblingLabel.Text = ShowingRecord.Sibling;
           

        }
    }
}









Form 1 Design:



Resultant form design:




Tuesday, September 3, 2013

Software Requirements Engineering

Software Requirements Engineering:

As we know that need is the mother of all inventions, Now if we take it in the sense that when ever we need any thing then we started trying to made that thing. Our needs told's that which thing we have to made, whose are the most needy modules of that thing which we required in our need. Now here thing to be noticed is that need is the base from where we get the requirements of that invention and requirements told's us that which we really have to made  which leads us to the invention of maximum output or near to perfectness.

In every ENGINEERING where we have to do sum new inventions we need the perfect requirements to do perfect invention, therefore requirements are equally most important  in every field and every engineering. Due to this importance of requirements A course of requirements with name of "REQUIREMENTS ENGINEERING" is announced and added in all the curriculum's of all engineering's at all universities. This course is just to teach the students to how to gather requirements of their inventions.

Now if we discuss this all in the respective of Software's or Software Engineering we found that every project for a software Engineer is a new invention because he have to made a new software for every new customer. Rarely its happens that the requirements of two customers match otherwise in every case every project is a new invention and due to this level of dissimilarity in requirements for software engineers they have to learn "REQUIREMENTS ENGINEERING" course deeply and sincerely because it is likely to be the core courses of SOFTWARE ENGINEERING.