Latest Activity In Study Groups

Join Your Study Groups

VU Past Papers, MCQs and More

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.


 

Assignment No. 02
Semester: Fall 2019

CS304- Object Oriented Programming 

 

 

Total Marks: 20

 

Due Date: 17/12/2020

 

Uploading instructions:

 

·         Your assignment should be in .CPP format (Any other formats like scan images, PDF, zip, doc, rar and bmp etc. will not be accepted).

·         Save your assignment with your ID (e.g. bc000000000.CPP).

·         No assignment will be accepted through email.

 

Rules for Marking:

 

It should be clear that your assignment will not get any credit if:

 

·         The assignment is submitted after due date.

·         The submitted assignment does not open, execute or file is corrupted.

·         Your assignment is copied from internet, handouts or from any other student.

      (Strict disciplinary action will be taken in this case).

 

Lectures Covered:

 

This assignment covers Lecture # 7-15.

 

Assignment

 

Suppose the Education Ministry ordered universities to show their student’s data along with their obtained marks of core course of the exams held during the lockdown so that they can take an idea of student's performance and make suitable policies for future in this pandemic situation.

To fulfill the above requirements of Ministry, Virtual University Of Pakistan hired you to perform this task, now you need to write a program that can register student's records and also can show all students’ data whenever required.

 

Consider the following part of Student class which is containing some data members in it.

 

class student

{          

int roll_no;

char name[20];

char sec;

//rest of the code

};

 

Tasks to do:

 

1.      Add a new field subject_marks in the Student class.

2.      Input number of records you want to enter, as shown in screenshot.

3.      Declare array as a pointer of student type of size given by the user using new operator.

4.      Display a menu that looks like following.

        a. Press 1 to enter new students.

        b. Press 2 to view all students’ data.

 

Your output should be same as sample output.

 

 

 

Sample Output:

 

 

                                                                              

                                                                               Best of luck!

 

 

 

NOTE:  Do not put any query on MDB about this assignment, if you have any query then email at cs304@vu.edu.pk.  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.

 

 

 

 

Deadline: Your assignment must be uploaded/submitted within due date i.e. 17th December, 2020.  

 

 

Views: 1835

Attachments:

Replies to This Discussion

Share the Assignment Questions & Discuss Here.... 

CS304 Assignment 2 Fall 2020 solution idea 3:

CPP Format: (Extract Zip file)

CS304_Assignment_No_02_Solution_Fall_2020

CS304 Assignment 2 Fall 2020 Solution idea:

#include<iostream>
#include<conio.h>
using namespace std;
int i,run=0;
class student
{
private:
int roll_no,subject_marks;
string name,section;
public:
void add();
void display();
};
void student::add()
{
cout"\n\n Roll No. : ";
cin>>roll_no;
cout"\n\n Name : ";
cin>>name;
cout"\n\n Section : ";
cin>>section;
cout"\n\n Core Subject Marks : ";
cin>>subject_marks;
}
void student::display()
{
cout"\n\n "roll_no"\t\t"name"\t"section"\t\t"subject_marks;
}
main()
{
int choice;
cout"\n\n No. Of Student : ";
cin>>i;
student *s[i];
p:
cout"\n\n 1. Add Data";
cout"\n 2. Display Data\n ";
cin>>choice;
switch(choice)
{
case 1:
if(run < i)
{
student *ptr = new student;
s[run] = ptr;
s[run] -> add();
run++;
}
break;
case 2:
cout"\n\n Roll No.\tName\tSection\t\tMarks";
for(int j=0;j<run;j++)
{
student *ptr = s[j];
ptr -> display();
}
break;
default:
cout"\n\n Invalid Value...Please Try Again...";
}
goto p;
}

cs304 assignment no 02 solution fall 2020

#include<iostream>

#include<conio.h>

using namespace std;

int i,run=0;

class student

{

                private:

                                int roll_no,subject_marks;

                                string name,section;

                public:

                                void add();

                                void display();  

};

                void student::add()

                {

                                cout"\n\n Roll No. : ";

                                cin>>roll_no;

                                cout"\n\n Name : ";

                                cin>>name;

                                cout"\n\n Section : ";

                                cin>>section;

                                cout"\n\n Core Subject Marks : ";

                                cin>>subject_marks;

                }

                void student::display()

                {

                                cout"\n\n "roll_no"\t\t"name"\t"section"\t\t"subject_marks;

                }

main()

{

                int choice;

                cout"\n\n No. Of Student : ";

                cin>>i;

                student *s[i];

                p:

                cout"\n\n 1. Add Data";

                cout"\n 2. Display Data\n ";

                cin>>choice;

                switch(choice)

                {

                                case 1:

                                                if(run < i)

                                                {

                                                student *ptr = new student;

                                                s[run] = ptr;

                                                s[run] -> add();

                                                run++;

                                                }

                                                break;

                                case 2:

                                                cout"\n\n Roll No.\tName\tSection\t\tMarks";

                                                for(int j=0;j<run;j++)

                                                {

                                                                student *ptr = s[j];

                                                                ptr -> display();

                                                }

                                                break;

                                default:

                                                cout"\n\n Invalid Value...Please Try Again...";

                }

                goto p;

}

 

CS304 Assignment Solution # 2 Fall 2020 - Object Oriented Programming

#include<iostream>

#include<conio.h>

using namespace std;

int i,run=0;

class student

{

                private:

                                int roll_no,subject_marks;

                                string name,section;

                public:

                                void add();

                                void display();  

};

                void student::add()

                {

                                cout"\n\n Roll No. : ";

                                cin>>roll_no;

                                cout"\n\n Name : ";

                                cin>>name;

                                cout"\n\n Section : ";

                                cin>>section;

                                cout"\n\n Core Subject Marks : ";

                                cin>>subject_marks;

                }

                void student::display()

                {

                                cout"\n\n "roll_no"\t\t"name"\t"section"\t\t"subject_marks;

                }

main()

{

                int choice;

                cout"\n\n No. Of Student : ";

                cin>>i;

                student *s[i];

                p:

                cout"\n\n 1. Add Data";

                cout"\n 2. Display Data\n ";

                cin>>choice;

                switch(choice)

                {

                                case 1:

                                                if(run < i)

                                                {

                                                student *ptr = new student;

                                                s[run] = ptr;

                                                s[run] -> add();

                                                run++;

                                                }

                                                break;

                                case 2:

                                                cout"\n\n Roll No.\tName\tSection\t\tMarks";

                                                for(int j=0;j<run;j++)

                                                {

                                                                student *ptr = s[j];

                                                                ptr -> display();

                                                }

                                                break;

                                default:

                                                cout"\n\n Invalid Value...Please Try Again...";

                }

                goto p;

}

 

 

CS304 Assignment 2 Fall 2020 solution idea 3:

CPP Format: (Extract Zip file)

CS304_Assignment_No_02_Solution_Fall_2020

RSS

© 2021   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service