+2 votes
56 views

cs304 assignment no 2 2020

Solution is here

Tags: CS201 Assignment No.2 Solution, CS201 Assignment No.2 Solution 2020, CS201 Assignment No.2 Solution Spring 2020, CS201 Assignment 2 Solution, CS201 Assignment 2 Solution 2020, CS201 Assignment 2 Solution Spring 2020, CS201 Assignment 2 2020 Solution, CS201 Assignment 2 Spring 2020 Solution, CS201 Assignment 2 2020, CS201 Assignment No 2 Solution, CS201 Assignment No 2 Solution 2020, CS201 Assignment No 2 Solution Spring 2020, CS201 Assignment No 2 2020 Solution, CS201 Assignment No 2 Spring 2020 Solution, CS201 Assignment No 2 2020

by (1.1k points)   | 56 views

1 Answer

+2 votes

Here is the Solution:

#include<iostream>
using namespace std;

class Question
{
    private : 
        int QuestionID;
        string QuestionType;
        int QuestionMarks;

    public :
        Question()
        {
            cout<<"Enter Question ID : ";
            cin>>QuestionID;
            cout<<"Enter Question Type : ";
            cin>>QuestionType;
            cout<<"Enter Question Marks : ";
            cin>>QuestionMarks;
        }
        void setQueID(int id)  
        {
            QuestionID=id;
        }

        void setQueType(string type)  
        {
            QuestionType=type;
        }
        void setQueMarks(int marks)  
        {
            QuestionMarks=marks;
        }
        int getQueID() const 
        {
            return QuestionID;
        }
        string getQueType() const 
        {
            return QuestionType;
        }
        int getQueMarks() const 
        {
            return QuestionMarks;
        }

};

class Exam
{
    private :
        string ExamType;
        string CourseCode;
        static const int NoOfQuestions=2;
        Question *questions[NoOfQuestions];

    public :
        Exam(string EType, string CCode)
        {
            ExamType=EType;
            CourseCode=CCode;
            for(int i=0; i<NoOfQuestions; i++)
            {
                cout<<"\n***** Enter Data of Question No. "<<i+1<<" *****\n";
                questions[i] = new Question();
            }
        }
        void DisplayInfo()
        {
            cout<<"----------------------------\n";
            cout<<"**** Displaying Exam Information ****";
            cout<<"\n----------------------------";
            cout<<"\nExam Type : "<<ExamType;
            cout<<"\nCourse Code : "<<CourseCode;
            cout<<"\nTotal No of Questions for Exam : "<<NoOfQuestions;

            cout<<"\n----------------------------\n";
            cout<<"**** Displaying Question Information ****";
            cout<<"\n----------------------------";
            for(int i=0; i<NoOfQuestions; i++)
            {
                cout<<"\nQuestion No. : "<<i+1;
                cout<<"\nQuestion Id : "<<questions[i]->getQueID();
                cout<<"\nQuestion Type : "<<questions[i]->getQueType();
                cout<<"\nQuestion Marks : "<<questions[i]->getQueMarks();
                cout<<"\n----------------------------";
            }
        }

};

main()
{

    cout<<"\n\t\tCS304 Assignment No. 2 Solution by Meansflow.com\n";
    cout<<"\nSubcribe my Youtube Channel Mian Athar\n";
    cout<<"Please register your account on my website for programming solutions\n\n";
    string type, code;
    cout<<"Enter Exam Type : ";
    getline(cin, type);
    cout<<"Enter Course Code : ";
    getline(cin, code);

    Exam exm1(type,code);

    exm1.DisplayInfo();
}
by (2.5k points)  

Related questions

+2 votes
1 answer
asked Jun 14 by toheed (1.1k points) | 80 views
+3 votes
0 answers
+3 votes
1 answer
+3 votes
1 answer
asked Jun 12 by toheed (1.1k points) | 105 views
+2 votes
0 answers
asked Jun 14 by awaisiqbal (165 points) | 8 views
+1 vote
1 answer
+1 vote
1 answer
asked May 28 by athar (2.5k points) | 23 views




Welcome to Meansflow - Where Developers and Students Learn, Share, & Build Careers, where you can ask questions and receive answers from other members of the community.
106 questions
75 answers
36 comments
93 users