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

انقذوني يا اخوان رحم الله والديكم

مغلق
بدأه alqassab في 9 نوفمبر 2004 · 3 رد · 470 مشاهدة · في منتدى تصميم صفحات الويب
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم ورحمة الله وبركاته

اخواني انا بحاجة ماسة للمساعدة وفي اسر ع وقت واذا كان بالامكان الرد علي الموضوع في هذه الليلة

انا ادرس بالغربة واحتاج من يساعدني في هذا المشروع

اللي يقدر يسوي يرد علي

ولكم مني جزيل الشكر والا متنان اخوكم القصاب

General

A competition consists of a group pf teams who compete against each other in a series of matches. For each team the organizers record the outcome of each of their matches, either win, lose or draw. The final competition score for a team is calculated by giving them 3 points for each match won, 1 point for each match drawn and no points for any match lost. You have been asked to write a simple prototype system that will record each team's performance and then display the name of the winning team with the highest final score.

Tasks:

(1) Implement and test each of the following auxiliary functions which are connected with the results for an individual team.

a. A function inputResult which allows the user to enter the result of a particular match for a team. The function should take the match number as a parameter and then allow the user to enter the result of that match. Ex. Either "win", "lose" or "draw". The function should ensure the user enters an acceptable value and then return that value to the function call

b. A function calcScore which given the number of wins and draws as parameters, returns the final competition points achieved.

c. A function displayResult which takes as parameters the team name and the number of wins, loses and draws the team achieved. The function should then display a nicely formatted alert window containing the following information: team name, number of wins, number of loses, number of draws, and final points scored.

(2) Implement a function teamScore which allows the results for a particular team to be recorded and their final point score calculates. The function should take the team name and the number of matches they have played as parameters. The function should then use the auxiliary functions from (1) above to allow the result of each match to be entered and a competition report to be produced for that team. The function should return the final point score that the team achieved in the competition.

(3) Finally, implement the main body of the program which should allow the user to enter the name and match results for each team in the competition, making use of the function teamScore defined above. It should record the name and score of the winning team and this information should be displayed after all match details have been entered. (Note: you may assume that a single team is always the outright winner)

الرجاء منكم الرد علي في اقرب وقت ممكن التسليم يوم الاربعاء

والله الموفق لكل خير

#2

نست اخبركم ان التصميم يكون بالجافا سكريبت

javascript

#3

بسم الله الرحمن الرحيم

أخي قصاب قمت بإعداد الكود التالي لك , ويمكنك أن تعدل فيه كما تشاء

وأرجو أن أكون أعنتك قبل فوات الأوان

// MatchResult Enumeration
MatchResult = {
    win  : 3,
    draw : 1,
    lose : 0
};

// Class Team
function Team(teamName) {
    this.TeamName = teamName;
    this.numberWins  = 0;
    this.numberDraws = 0;
    this.numberLoses = 0;
    this.matchScores = new Array();

    this.inputResult = function(matchNumber, matchResult) {
        // validate the user entry data
        if( MatchResult[matchResult] == undefined ) {
            throw new Error("please enter valid match result");
        }

        this.matchScores[matchNumber-1] = MatchResult[matchResult];
        switch( MatchResult[matchResult] ) {
            case MatchResult.win :
                 this.numberWins++; break;
            case MatchResult.draw :
                 this.numberDraws++; break;
            case MatchResult.lose :
                 this.numberLoses++; break;
        }
    }

    // calcScore
    this.calcScore = function(numberWins, numberDraws) {
        return ( MatchResult.win * numberWins + MatchResult.draw * numberDraws );
    }

    this.displayInfo = function() {
        var outputStr = "the Winner Team\n";

        outputStr += "team name: " + this.TeamName + "\r\n";
        outputStr += "  number of wins : " + this.numberWins + "\r\n";
        outputStr += "  number of draws: " + this.numberDraws + "\r\n";
        outputStr += "  number of loses: " + this.numberLoses + "\r\n";
        outputStr += "--------------------------------------\r\n";
        outputStr += "  final points scored: " + this.calcScore(this.numberWins, this.numberDraws);

        outputStr += "\n\nMatches Summary : \n";
        for( var i=0; i<this.matchScores.length; i++ ) {
            outputStr += "Match Number: " + (i+1);
            outputStr += " point score : " + this.matchScores + " \n";
        }

        alert(outputStr);
    }
}

// Class TeamCollection
function TeamCollection() {
    this.WinnerTeam;
    this.WinnerTeamScore = 0;

    this.teams = new Array();

    // getTeam
    this.getTeam = function(teamName) {
        return this.teams[teamName];
    }

    // displayResult
    this.displayResult = function(teamName, numberWins, numberDraws, numberLoses) {
        var teamIteam = this.getTeam(teamName);
        var outputStr = ""

        outputStr += "team name: " + teamIteam.TeamName + "\r\n";
        outputStr += "  number of wins : " + numberWins + "\r\n";
        outputStr += "  number of draws: " + numberDraws + "\r\n";
        outputStr += "  number of loses: " + numberLoses + "\r\n";
        outputStr += "--------------------------------------\r\n";
        outputStr += "  final points scored: " + teamIteam.calcScore(numberWins, numberDraws);

        alert(outputStr);
    }

    // teamScore
    this.teamScore = function(teamName, matchNumbers) {
        this.teams[teamName] = new Team(teamName);
        var teamIteam = this.getTeam(teamName);
        
        for( var i=0; i<matchNumbers; i++ ) {
            var matchResult = prompt("Team " + teamName + " : \nenter the match result it must be either win , draw or lose");
            try {
                teamIteam.inputResult(i+1, matchResult);
            }catch( e ) {
                alert( e.message );
                i--; continue;
            }
        }

        var teamScore = teamIteam.calcScore(teamIteam.numberWins, teamIteam.numberDraws);
        if( teamScore > this.WinnerTeamScore ) {
            this.WinnerTeamScore = teamScore;
            this.WinnerTeam = teamIteam;
        }

        this.displayResult(teamName, teamIteam.numberWins, teamIteam.numberDraws, teamIteam.numberLoses);
    }

}

teams = new TeamCollection();
teams.teamScore("team1", 3);
teams.teamScore("team2", 2);

teams.WinnerTeam.displayInfo();

matchJs.rar

29_5.gif

سورة العنكبوت

ـــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ

مشروع Arabic PHP.NET

حلم طالما كان يراودني حتي قهرته بحمد الله ليكون حقيقة

ـــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ

سلسلة أنماط التصاميم البرمجية Desgin Patterns

سلسلة أنماط التصاميم البرمجية Desgin Patterns | كتيب هذه الدروس (إعداد أحمد غريب)

ـــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ

كنترول ASP.NET DataGrid CheckBoxColumn

كنترول ProgressBar

كنترول UltraPanel

مشروع الكنترول الأنيق (إهداء للفريق العربي)

الورش الإلكترونية IT Workshops

تعقب الأخطاء error tracing

كنترول ColorPicker لمطوري الويب

RichTextBox Control لمطوري ال ASP.Net

حمل كتاب جافا سكربت عربي

#4

جزاك الله الف خير

لا ادري ما ذا اقول وكيف اشكرك على هذا المساعدة

تقبل الله صيامكم وعملكم ان شاء الله

مشكور اخي الكريم

هذا الموضوع مغلق.

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