Skip to content

304 - Object Oriented Programming

2 Topics 27 Posts
  • CS304 Assignment 2 Solution and Discussion

    Solved cs304 assignment 2 solution discussion spring 2020
    3
    0 Votes
    3 Posts
    975 Views
    zaasmiZ
    #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 \n"; cout<<"\nPlease Subscribe Cyberian Youtube Channel to get Solutions of all Programming Assignments\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(); }
  • 0 Votes
    2 Posts
    4k Views
    cyberianC
    https://youtu.be/Q99g1IXwRqk [image: 1qokIDt.png]
Reputation Earning
How to Build a $1,000/Month World CUP LIVE Matches Live Cricket Streaming
Sponsored
File Sharing
Stats

1

Online

3.1k

Users

2.8k

Topics

8.6k

Posts
Popular Tags
Online User
| |