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.


Question No. 1 [Marks 10]: 

You are given some literals (variable names, data type names, function names) in Column-1. Rewrite them in column-3 by following the standard C++ / JAVA coding conventions.

Note: Column-2 contains description of each literal (given in column-1) for your help.

Column-1 (Literals) Column-2 (Description) Column-3 (Re-Written after following standard JAVA coding conventions)
complexnumber “complexnumber” is a data type. Any variable of this type can be used to store a complex number.
monthlytaxrate “monthlytaxrate” is a variable used to store an employee’s monthly tax rate.
speed_of_light “speed_of_light” is a constant variable to store the speed of light.
void setstudentgrade() {

}
“setstudentgrade()” is function in student class.
address “address” is a private member of “Employee” class



Question No. 2 [Marks 10]

"Suppose you want to develop a Graphics library, you want that the client should be able to instantiate only one instance of the library class(s) at a time"

What design pattern you think, is most appropriate for implementing such type of library? Answer your question with solid reasons.

Views: 2296

Replies to This Discussion

CS504_Assign_4_solution

see the attached file please

Attachments:

Software Engineering-1 (CS504)

Assignment # 4 (Fall 2011)

  Total marks = 20

 

Question No. 1 [Marks 10]:

 

You are given some literals (variable names, data type names, function names) in Column-1. Rewrite them in column-3 by following the standard C++ / JAVA coding conventions.

 

Note: Column-2 contains description of each literal (given in column-1) for your help.

 

Column-1 (Literals)

Column-2 (Description)

Column-3 (Re-Written after following standard JAVA coding conventions)

complexnumber

“complexnumber” is a data type. Any variable of this type can be used to store a complex number.

ComplexNumber

monthlytaxrate

“monthlytaxrate” is a variable used to store an employee’s monthly tax rate.

monthlyTaxRate

speed_of_light

“speed_of_light” is a constant variable to store the speed of light.

SPEED_OF_LIGHT

void setstudentgrade() {

}

“setstudentgrade()” is function in student class.

void setStudentGrade(){

}

address

“address” is a private member of “Employee” class

class SomeClass

{

      private:

          char address;

};

 

 

www.vustudents.ning.com

 

Question No. 2 [Marks 10]

 

"Suppose you want to develop a Graphics library, you want that the client should be able to instantiate only one instance of the library class(s) at a time"

 

What design pattern you think, is most appropriate for implementing such type of library? Answer your question with solid reasons. www.vustudents.ning.com

 

Answer:

The most appropriate design pattern is Singleton Pattern.

Reasons:

  • The singleton pattern is one of the GOF (Gang of Four) patterns. This particular pattern provides a method for limiting the number of instances of an object to just one. It’s an easy pattern to grasp once you get past the strange syntax used.
  • This pattern is used only for instantiation of a single instance because only this pattern provides this facility
  • The intent of this pattern is that a class only has one instance and provides a global point of access to it.
  • The singleton pattern is one of the simplest design patterns; it involves only one class which is responsible to instantiate itself, to make sure it creates not more than one instance; in the same time it provides a global point of access to that instance. In this case the same instance can be used from everywhere, being impossible to invoke directly the constructor each time.
  • Singletons do not create unnatural interdependencies made by passing a context object around, where every piece of code will bind to everything in the context object.
  • The power of the Singleton goes beyond just controlling the instance count.

 

 

 

www.vustudents.ning.com

 

MIT VIRTUALIANS CS504 Assignment No.4

See the attached file please

Attachments:

RSS

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

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