<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[CS304 Assignment 2 Solution and Discussion]]></title><description><![CDATA[<p dir="auto">Assignment No. 02<br />
Semester: Fall 2019<br />
CS304- Object Oriented Programming</p>
<p dir="auto">Total Marks: 20</p>
<p dir="auto">Due Date: 28/11/2019</p>
<p dir="auto">Uploading instructions:</p>
<p dir="auto">•	Your assignment should be in .CPP format (Any other formats like scan images, PDF, zip, doc, rar and bmp etc. will not be accepted).<br />
•	Save your assignment with your ID (e.g. bc000000000.CPP).<br />
•	No assignment will be accepted through email.</p>
<p dir="auto">Rules for Marking:</p>
<p dir="auto">It should be clear that your assignment will not get any credit if:</p>
<p dir="auto">•	The assignment is submitted after due date.<br />
•	The submitted assignment does not open, execute or file is corrupted.<br />
•	Your assignment is copied from internet, handouts or from any other student.<br />
(Strict disciplinary action will be taken in this case).</p>
<p dir="auto">Lectures Covered:</p>
<p dir="auto">This assignment covers Lecture # 7-15.</p>
<p dir="auto">Assignment 	<br />
Consider the following part of class diagram which is showing composition relationship between League and Franchise classes.<br />
<img src="https://i.imgur.com/5zWzyjz.png" alt="9795b0c6-5a4d-4994-85bf-9928a2f4f01b-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Tasks to do:</p>
<p dir="auto">You are required to write C++ code to create Franchise and League classes. Your classes should contain data members, constructors and member functions according to the given diagram. You also need to implement composition relationship between these classes.</p>
<p dir="auto">Your output should be same as sample output.</p>
<p dir="auto">Sample Output:<br />
<img src="https://i.imgur.com/g0uc70X.png" alt="1ad0921d-927b-4488-95bb-e95b87618a61-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Best of luck!</p>
<p dir="auto">NOTE:  Do not put any query on MDB about this assignment, if you have any query then email at <a href="mailto:cs304@vu.edu.pk" target="_blank" rel="noopener noreferrer nofollow ugc">cs304@vu.edu.pk</a>.  Furthermore, if any student found cheating from any other student or from online forums then he/she will be awarded ZERO right away and strict disciplinary action will be taken against the student.</p>
<p dir="auto">Deadline: Your assignment must be uploaded/submitted on or before 28th November 2019.</p>
]]></description><link>https://community.secnto.com//topic/701/cs304-assignment-2-solution-and-discussion</link><generator>RSS for Node</generator><lastBuildDate>Mon, 08 Jun 2026 19:59:47 GMT</lastBuildDate><atom:link href="https://community.secnto.com//topic/701.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 28 Nov 2019 17:08:45 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to CS304 Assignment 2 Solution and Discussion on Thu, 16 Jan 2020 08:15:52 GMT]]></title><description><![CDATA[<p dir="auto"><strong>Solution:</strong></p>
<pre><code>#include &lt;iostream&gt;
using namespace std;
class Franchise{
    string name;
    string city;
    public:
    Franchise(){
        name= "";
        city="";
        
    }    
     void setname(string n){
        name= n;
    }
    void setcity(string c){
        city=c;
    }
    
    string getfname(){
        return name;
    }
    string getfcity(){
        return city;
    }
   
};
class League{
  private:
  string name;
  string year;
  string country;
  Franchise franchiseObject;
  
  public:
  League(string fname,string fcity,string n,string y,string c){
  	
  	franchiseObject.setname(fname);
  	franchiseObject.setcity(fcity);
      name=n;
      year=y;
      country=c;
  }

  void displayInfo(){
      cout &lt;&lt; "League name : " &lt;&lt; name&lt;&lt;endl;
      cout &lt;&lt; "League year : " &lt;&lt; year&lt;&lt;endl;
      cout &lt;&lt; "League country : " &lt;&lt; country&lt;&lt;endl;
  
      cout &lt;&lt; "Franchise name : " &lt;&lt; franchiseObject.getfname()&lt;&lt;endl;
      cout &lt;&lt; "Franchise city : " &lt;&lt; franchiseObject.getfcity()&lt;&lt;endl;
  }
};

int main()
{

    League lg("Islamabad United","Islamabad","PSL","2020","PAKISTAN");
    lg.displayInfo();
    
   return 0;
}



</code></pre>
]]></description><link>https://community.secnto.com//post/2001</link><guid isPermaLink="true">https://community.secnto.com//post/2001</guid><dc:creator><![CDATA[zareen]]></dc:creator><pubDate>Thu, 16 Jan 2020 08:15:52 GMT</pubDate></item><item><title><![CDATA[Reply to CS304 Assignment 2 Solution and Discussion on Thu, 28 Nov 2019 17:10:30 GMT]]></title><description><![CDATA[<p dir="auto"><a href="https://youtu.be/trOfRyB5cHg" target="_blank" rel="noopener noreferrer nofollow ugc">https://youtu.be/trOfRyB5cHg</a></p>
]]></description><link>https://community.secnto.com//post/2000</link><guid isPermaLink="true">https://community.secnto.com//post/2000</guid><dc:creator><![CDATA[zareen]]></dc:creator><pubDate>Thu, 28 Nov 2019 17:10:30 GMT</pubDate></item><item><title><![CDATA[Reply to CS304 Assignment 2 Solution and Discussion on Thu, 16 Jan 2020 08:16:05 GMT]]></title><description><![CDATA[<pre><code>

    #include&lt;iostream&gt;
    #include&lt;string&gt;
    using namespace std;

    class Franchise{
    private:
    string name;
    string city;

    public:
    Franchise();
    void setName(string);
    void setCity(string);
    string getName();
    string getCity();
    };

    Franchise::Franchise(){

    }
    void Franchise::setName(string n){
    name = n;
    }

    void Franchise::setCity(string c){
    city = c;
    }
    string Franchise::getName(){
    return name;
    }

    string Franchise::getCity(){
    return city;
    }

    class league{
    private:
    string naame;
    string country;
    int year;
    Franchise french;

    public:
    league(string , int, string , string , string);
    void displayInfo();
    };

    league::league(string n, int y, string c, string name, string city){
    naame = n;
    country = c;
    french.setCity(city);
    city = french.getCity();
    year = y;
    french.setName(name);
    name = french.getName();
    }

    void league::displayInfo(){
    cout"League Name:"naameendl;
    cout"League Year:"yearendl;
    cout"League County :"countryendl;
    cout"Franchise name:"french.getName()endl;
    cout"Frenchise City:"french.getCity()endl;
    }

    int main(){

    league l("PSL",2020,"Pakistan","Sargodha Eagles","Sargodha");
    l.displayInfo();

    }

</code></pre>
<pre><code>

    #include&lt;iostream&gt;
    #include&lt;string&gt;
    using namespace std;

    class Franchise{
    private:
    string name;
    string city;

    public:
    Franchise();
    void setName(string);
    void setCity(string);
    string getName();
    string getCity();
    };

    Franchise::Franchise(){

    }
    void Franchise::setName(string n){
    name = n;
    }

    void Franchise::setCity(string c){
    city = c;
    }
    string Franchise::getName(){
    return name;
    }

    string Franchise::getCity(){
    return city;
    }

    class league{
    private:
    string naame;
    string country;
    int year;
    Franchise french;

    public:
    league(string , int, string , string , string);
    void displayInfo();
    };

    league::league(string n, int y, string c, string name, string city){
    naame = n;
    country = c;
    french.setCity(city);
    city = french.getCity();
    year = y;
    french.setName(name);
    name = french.getName();
    }

    void league::displayInfo(){
    cout"League Name :"naameendl;
    cout"League Year :"yearendl;
    cout"League County :"countryendl;
    cout"Franchise name :"french.getName()endl;
    cout"Frenchise City :"french.getCity()endl;
    }

</code></pre>
]]></description><link>https://community.secnto.com//post/1999</link><guid isPermaLink="true">https://community.secnto.com//post/1999</guid><dc:creator><![CDATA[zareen]]></dc:creator><pubDate>Thu, 16 Jan 2020 08:16:05 GMT</pubDate></item><item><title><![CDATA[Reply to CS304 Assignment 2 Solution and Discussion on Thu, 28 Nov 2019 17:09:37 GMT]]></title><description><![CDATA[<p dir="auto"><a href="https://youtu.be/YdACTwbL-h4" target="_blank" rel="noopener noreferrer nofollow ugc">https://youtu.be/YdACTwbL-h4</a></p>
]]></description><link>https://community.secnto.com//post/1998</link><guid isPermaLink="true">https://community.secnto.com//post/1998</guid><dc:creator><![CDATA[zareen]]></dc:creator><pubDate>Thu, 28 Nov 2019 17:09:37 GMT</pubDate></item></channel></rss>