Assignment No. 01
Semester: Fall 2014
CS304: Object Oriented Programming Total Marks: 20
Due Date:20/11/2014
Instructions:
Please read the following instructions carefully before submitting assignment. It should be clear that your assignment will not get any credit if:
§1 The assignment is submitted after due date.
§2 The submitted assignment does not open or file is corrupt.
§3 Assignment is copied(partial or full) from any source (websites, forums, students, etc)
Note: You have to upload only .cpp file. Assignment in any other format (extension) will not be accepted and will be awarded with zero marks. For example, if you submit code in .doc (Word document) or .txt files or .exe file, no reward will be given in any case.
Objective:
The objective of this assignment is to provide hands on experience of:
§1 Basic concepts of classes and objects in C/C++ language
§2 Dealing with member functions
§3 Dealing with Constructors
§4 Calling member functions through objects of classes
§5 Saving a program
§6 Compiling a program
§7 Executing the program
Guidelines:
§ Code should be properly indented and well commented.
§1 Follow C/C++ guide lines while writing variable names, function names etc
§2 Use only dev-C++ for this assignment.
Assignment
Problem Statement:
Write the C++ language program that should fulfill the following requirements:
Program should contain two classes as “Student” and “Instructor”. Within main() function, create the objects of these two classes. Display your student ID and name by passing as attributes(student ID, name) while instantiating the object of the “Student” class. Using the object of the Instructor Class, call its member function Input() to take input for the height of the 8 instructors then call its member function print() to display the average height of the instructors.
Declare data members by private and member functions by public access specifier for both classes.
Function
Description
main() function
Objects of both classes will be created in it, and respective member functions of these objects will be called.
Student(char *, char *)
Constructor of the Student class to display your own student ID and name
input()
Function of Instructor class , it will take heights as input of 8 instructors
print()
Function of Instructor class, it will display average height of 8 instructors.
Detailed Description:
Your program should display your own student ID and name on the top of the screen through passing as attributes at the time of instantiating object of the Student class i.e.
Student ID : MC104403787
Student Name : Rehman
Member function input() of the “Instructor” class should take height as input of the 8 instructors from the user i.e.
Enter Instructor 1 Height in Feet : 5.5
Member function print() of the “Instructor” class should display average height of the Instructors.
Sample output of the program:
BEST OF LUCK!
For any query about the assignment, contact at cs304@vu.edu.pk
Tags:
plz someone give any idea of this how to write programm in C++
ful solution plz de aj last date ha
Please Discuss here about this assignment.Thanks
Our main purpose here discussion not just Solution
We are here with you hands in hands to facilitate your learning and do not appreciate the idea of copying or replicating solutions.
Please tora discuss karo assignment ko
yara nu ta khu der khafa warta nast ye alak
No sa wakam yara, ado sok pa k sa kai hom na.
Dear Students Don’t wait for solution post your problems here and discuss ... after discussion a perfect solution will come in a result. So, Start it now, replies here give your comments according to your knowledge and understandings....
plzz discuss about the assignment solution
Enjoy
#include <iostream>
using namespace std;
class Student
{
private:
char *ID , *Name;
public:
Student(char *i , char *n)
{
ID = i;
Name = n;
}
void Display()
{
cout"Student ID IS : "IDendl;
cout"Student Name IS: "Nameendl;
}
};
static double Total = 0;
class Instructor
{
private:
double array[8];
double x ;
public:
void In()
{
for(int i = 1; i<= 8; i++)
{
cout"Enter Instructor "i" Height in Feet: ";
cin>>array[i];
Total += array[i];
}
}
void Display()
{
x = Total/8;
cout "Average Height in Feet: "xendl;
}
};
main()
{
Student obj1("BC120201991", "Zahid IQbal");
obj1.Display();
Instructor obj2;
obj2.In();
obj2.Display();
system("pause");
}
Dear Students Don’t wait for solution post your problems here and discuss ... after discussion a perfect solution will come in a result. So, Start it now, replies here give your comments according to your knowledge and understandings....
© 2021 Created by + M.Tariq Malik.
Powered by
Promote Us | Report an Issue | Privacy Policy | Terms of Service
We are user-generated contents site. All product, videos, pictures & others contents on site don't seem to be beneath our Copyrights & belong to their respected owners & freely available on public domains. We believe in Our Policy & do according to them. If Any content is offensive in your Copyrights then please email at m.tariqmalik@gmail.com with copyright detail & We will happy to remove it immediately.
Management: Admins ::: Moderators
Awards Badges List | Moderators Group
All Members | Featured Members | Top Reputation Members | Angels Members | Intellectual Members | Criteria for Selection
Become a Team Member | Safety Guidelines for New | Site FAQ & Rules | Safety Matters | Online Safety | Rules For Blog Post