Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Object Oriented Programming (CS304) Assignment No.4 solution 12/01/2011
VU Help • House Banner VU Help Virtual University Students - Assignments, Solved Papers, GDB & Exam Help Student Help Forum • Collaborative • Free Support
#1
Assignment

Introduction:

In Assignment No.1 you developed Object Oriented Model for Library Management System and in Assignment #2 you developed its practical prototype in c++ that you didn’t give actual implementation in c++ but simple stereotype (sketch) in the form of c++ code mentioning class names their parameters and functions with access specifiers you also showed the relationship between classes in the form of inheritance mentioning the name of class/classes from which they have been derived in proper c++ syntax.


Description:

As you know in a header file (.h) for a class we include its declaration while in implementation file (.cpp) part we add implementation of all methods of that class. In this assignment you have to do exactly the same for only one class in your Dev c++ project you already had created in Assignment No.2 (Library Management System), you have to add the following for each class,

1. Necessary attributes with suitable data types in its header file (Data Members)
2. Constructor and Destructor of that class
3. Getters and Setters for all its Data Members (also make them const where required)
Important Note:

• In this assignment code given for any class (Library, student, administrator etc) should be correct however you are NOT required to create this class’s objects and call their methods in main these things might be required in next assignment.
• Although it is not requirement you can start from code generated using argoUML for each class.


Uploading Instructions:

You have to upload your single zipped dev c++ project as you did in Assignment No. 2 and 3
Appendix:

Example code for a Course class to store any course attributes is given below similarly you have to add code for all your classes in your Dev c++ project,


Course.h
Code:
#include <iostream> using namespace std; class Course { public: Course(char * , char * , int ); void setName(char *); char *getName() const ; void setCode(char *); char *getCode() const ; int gerCreditHours(); void setCreditHours(int); int getCreditHours()const ; ~Course(); private: char *name; char *code; int credithours; };
Course.cpp
Code:
Course::Course(char * _name, char * _code, int _credithours) { name = new char[strlen(_name)]; strcpy(name,_name); code = new char[strlen(_code)]; strcpy(code,_code); credithours = _credithours; } void Course::setName(char * _name) { if ( name !=NULL ) delete []name; name = new char[strlen(_name)]; strcpy(name,_name); } char * Course::getName() const { return name; } void Course::setCode(char * _code) { if (code != NULL) delete []code; code = new char[strlen(_code)]; strcpy(code,_code); } char * Course::getCode() const { return code; } void Course::setCreditHours(int _credithours ) { credithours = _credithours; } int Course::getCreditHours() const { return credithours; } Course::~Course() { if(name != NULL) delete []name; if (code != NULL) delete []code; }

Solution can be found in the attachment


Attached Files
.zip   cs304 - 4.zip (Size: 1.03 KB / Downloads: 494)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Make vu datesheet final term fall 2010 on 14 jan 2011 Xpert 6 7,838 11-28-2013, 11:30 PM
Last Post: Xpert
  Virtual University Midterm result has been announced on 23 december, 2011 rabeel 6 2,561 12-30-2011, 11:34 PM
Last Post: sonia touqeer
  3rd Convocation of Virtual University of Pakistan December 2011-2012 Vuhelper 1 1,125 12-28-2011, 07:39 PM
Last Post: rabeel
  Attention Overseas Students: Your Cancelled Paper (dated: 30-Nov-2011 8:00am PST) Res Vuhelper 0 961 12-09-2011, 10:25 PM
Last Post: Vuhelper
  Scholarships Fall 16 November 2011 Vuhelper 0 1,917 11-16-2011, 08:32 PM
Last Post: Vuhelper
  Virtual University announced the Eid-ul-Azha holidays for 2011 sanam 0 1,828 11-03-2011, 05:08 PM
Last Post: sanam
  Cs assignments of Vu dates are extended to 10 November, 2011 rabeel 0 2,187 11-03-2011, 04:54 AM
Last Post: rabeel
  Vulms is making problem and the dates are extended today 2 November, 2011 rabeel 2 2,619 11-02-2011, 10:33 PM
Last Post: rabeel
  Make your datesheet of FAll 2011 semester on 27th October, 2011 rabeel 0 2,162 10-27-2011, 11:20 PM
Last Post: rabeel
  Virtual University of Pakistan will be closed on Monday 24 October, 2011 Vuhelper 1 1,968 10-24-2011, 03:12 PM
Last Post: Xpert

Forum Jump:


Users browsing this thread: 1 Guest(s)
VU Help • House Banner VU Help Virtual University Students - Assignments, Solved Papers, GDB & Exam Help Student Help Forum • Collaborative • Free Support