https://www.google.com/contributor/welcome/?utm_source=publisher&utm_medium=banner&utm_campaign=2376261057261409

Search This Blog

Search with our Site

Custom Search

Monday, April 29, 2013

CS301 Assignment # 2 Solution 2013

//**************************From I_am Pakistan*****************************/
//**************************www.vustudents.ning.com*****************************/
#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
using namespace std;
void bestSeller(double,double,double);
class Node {
private:
         char SocialGroup;
         Node * Next;

public:
       void setSocialGroup(char sg){
             SocialGroup=sg;                  
            }
       char getSocialGroup() {      
             return SocialGroup;
            }
      void setNext(Node *n){
              Next=n;
            }
       Node *getNext(){
             return Next;
            }
};

class Queue
{
Node * front;
Node * rear;  
static int visitor;   
int harrypotter_ticket; 
int englishvinglish_ticket;
int takken_ticket;
int male;
int female;
int kids;
      
public :

Queue()
{
         front=new Node();
         front->setSocialGroup('\0');
         front->setNext(NULL);
         rear=NULL;
            harrypotter_ticket=0;
            englishvinglish_ticket=0;
            takken_ticket=0;
            male=0;
            female=0;
            kids=0;
            
            }   
~Queue()
{   
    cout<<"\nObject Deleted";            
}
       
void addTicket(char s,int c)
{
            Node *node=new Node();
            node->setSocialGroup(s);
  switch(c){
            case 1:
               harrypotter_ticket++; 
               group(s);                   
            break;

            case 2:
              englishvinglish_ticket++;
              group(s);                                 
              break;
            case 3:
              takken_ticket++;
              group(s);                                 
              break;
            default:
              break;
             }                        
     if(rear!=NULL){
      
            node->setNext(rear->getNext());
      rear->setNext(node);
      rear=rear->getNext();
      visitor++;
           }
        
     else{
          rear =node;
             rear->setNext(front->getNext());
             front->setNext(rear);
             visitor++;
            }}
            

void group(char g)
{
            if(g=='m' || g=='M')
               {male++;}
            else if(g=='f' || g=='F')
               {female++;} 
            else
               {kids++;}     
}
int  totalVisitors(int c) 
{
if(c==0)
{
       return visitor;     // sum of all visitors   
}     
if(c==1)
{
        return harrypotter_ticket;
}
else if(c==2)
{
       return englishvinglish_ticket;
}
else
{
      return   takken_ticket;     
}} 
 
double totalRevenue(int c)
{
if(c==1)
{
              return  ((double)harrypotter_ticket*650); 
}
          
else if(c==2)
{
            return ((double)englishvinglish_ticket*650);
}
              
else if(c==3)
{
             return ((double)takken_ticket*650);
             
}}

void papolarity(char *movie)
{
  if(male>female && male>kids)
{
    cout<<movie<<" is popular among Males\n";
}    
 else if(female>kids)
{
   cout<<movie<<" is popular among Female\n";
}
 else if(kids>female)
{
    cout<<movie<<" is popular among Kids\n";
}   
else
{
    cout<<movie<<" has Average Popularity\n";
}}

void dequeueVisitors(int num)
{
for(int i=0;i<num;i++)
{     
Node *temp=front;
front=front->getNext();
delete temp;
}}};
int Queue::visitor;


main()
{

Queue *harry_potter= new Queue(); 
Queue *english_vinglish= new Queue(); 
Queue *takken= new Queue(); 

char choice;
int tot_visitors;
int HP_visitors=0;
int EV_visitors=0;
int TK_visitors=0;
double HP_revenue=0;
double EV_revenue=0;
double TK_revenue=0;
char group;
char YesNo;
bool loop=true;
cout<<"Enter 1 for Harry Potter\nEnter 2 for English Vinglish\nEnter 3 for Takken\n";
cout<<"----------------------------\n";
while(loop)
{
label1:
cout<<"Kindely Enter Correct Choice(1-3): ";
cin>>choice;
switch(choice)
{
case '1':
socialGroup1:  
     cout<<"Enter your Social Group(M for male , F for femal and K for kid) ";
     cin>>group;
if(group=='m' || group=='M' || group=='f' || group=='F' || group=='k' || group=='K')     
{
     harry_potter->addTicket(group,1);
     HP_visitors=harry_potter->totalVisitors(1);
     HP_revenue=harry_potter->totalRevenue(1);
}
else
{
    cout<<"**Invalid Input for Social Group**\n";
    goto socialGroup1;
}     
     break;
case '2':
socialGroup2:     
     cout<<"Enter your Social Group(M for male , F for femal and K for kid) ";
     cin>>group;
if(group=='m' || group=='M' || group=='f' || group=='F' || group=='k' || group=='K')     
{     
     english_vinglish->addTicket(group,2);
     EV_visitors=english_vinglish->totalVisitors(2);
     EV_revenue=english_vinglish->totalRevenue(2); 
}
else
{
    cout<<"**Invalid Input for Social Group**\n";
    goto socialGroup2;    
}         
     break;
case '3':
socialGroup3:
    cout<<"Enter your Social Group(M for male , F for femal and K for kid) ";
    cin>>group;     

if(group=='m' || group=='M' || group=='f' || group=='F' || group=='k' || group=='K')     
{     
     takken->addTicket(group,3);
     TK_visitors=takken->totalVisitors(3);
     TK_revenue=takken->totalRevenue(3);  
} 
else
{
    cout<<"**Invalid Input for Social Group**\n";
    goto socialGroup3;    
}        
     break;
default:
     cout<<"Invalide Input\n"; 
     goto label1;  
     break;               
}
label2: 
     cout<<"Do you want to buy Another Ticket (Y/N): ";
     cin>>YesNo;
     if(YesNo=='y' || YesNo=='Y')
     {
                 loop=true;
     }
     else if(YesNo=='n' || YesNo=='N')
     {
                 loop=false;
     }
    else
    {
         cout<<"\n**(PLease Enter Correct Word)**\n";
         goto label2;
    }
    
}
system("cls");
cout<<endl<<"******* Response of Each Movie **************\n";
cout<<endl<<"Total Number of tickets sold for Harry Potter: "<<HP_visitors;  
cout<<endl<<"Total Number of tickets sold for Harry English Vinglish: "<<EV_visitors;
cout<<endl<<"Total Number of tickets sold for Takken: "<<TK_visitors<<endl;


cout<<"\n******* Revenue generated By  each Movie **************\n";
cout<<endl<<"Harry Potter Revenue: "<<HP_revenue;  
cout<<endl<<"English Vinglish  Revenue: "<<EV_revenue;  
cout<<endl<<"Takken Revenue: "<<TK_revenue<<endl;
cout<<"\nTotal revenue of the cenima is "<<HP_revenue+EV_revenue+TK_revenue<<endl<<endl;
bestSeller(HP_revenue,EV_revenue,TK_revenue);

cout<<"\n******* PoPularity of each Movie Among Social Group**************\n\n";
 
harry_potter->papolarity("Harry Potter");
english_vinglish->papolarity("English Vinglish");
takken->papolarity("Takken");

harry_potter->dequeueVisitors(HP_visitors);// delete all harry potter visitors
english_vinglish->dequeueVisitors(EV_visitors); // delete all English Vinglsh visitors
takken->dequeueVisitors(TK_visitors);//// delete all Takken visitors

delete harry_potter;
delete english_vinglish;
delete takken;


cout<<"\n********* From i_am Pakistan**************";
cout<<endl<<"*********www.vustudents.ning.com***********";
getch();
}
void bestSeller(double x,double y,double z)     
{
if(x>y && x>z)
{
    cout<<"Harry Potter is the Best Seller Movie of the Cenima";
}    
 else if(y>z)
{
    cout<<"English Vinglish is the Best Seller Movie of the Cenima";
}
 else if(z>y)
{
   cout<<"Takken is the Best Seller Movie of the Cenima";
}   
else
{
    cout<<"Average Sale";
}}

Saturday, April 27, 2013

CS301 Assignment No 02 Solution & Discussion Due Date:02-05-2013

Instructions
Please read the following instructions carefully before solving & submitting assignment:
It should be clear that your assignment will not get any credit (zero marks) if:
o The assignment is submitted after due date.
o The submitted code does NOT compile.
o The submitted assignment is other than .CPP file.
o The submitted assignment does NOT open or file is corrupted.
o The assignment is copied (from other student or ditto copy from handouts or internet).
Uploading instructions
For clarity and simplicity, You are required to Upload/Submit only ONE .CPP file.
Don’t wait for grace day. Grace day is only given if there is problem on due date. Submit your solution within
due date.
Note that no assignment will be accepted through email if there is any problem on grace day.

Note: Use ONLY Dev‐C++ IDE.
Objective
Note: Use ONLY Dev‐C++ IDE.
Objective
The objective of this assignment is

o To make you familiar with queue and linked list data structure and programming techniques to
implement queue as linked list.


GOOD LUCK
Marks: 20
Suppose three movies (Harry Potter, English Vinglish and Tekken) are on display in a cinema. Three different
counters are distributing tickets for each movie. To purchase a particular movie ticket, you are required to standin the respective movie counter queue.

Considering the above scenario, write a C++ program which asks a user to choose the movie for which he/she
would like to purchase a Ticket. While choosing the movie ticket, user should be asked to enter his/her social
group [F for female, M for male and K for kids].
The required program functionalities should be:
 Take input for all the three movies.
 Display the total number of visitors for each movie.
 Display total revenue of cinema and total revenue of each movie (Suppose price of one ticket is 650/-).
 Display the best business earning movie of the cinema.
 Check the popularity of each movie amongst social groups (females, males or kids).
Solution Guidelines:

1) To purchase the movie ticket, viewer must have to stand in the queue. The length of the queue can vary so you have
to implement queue as link list.
2) Create a class named Viewer (Node class); this class should create a node for each ticket. This class should define two
private data members, social group and Next pointer. A constructor, getter and setter functions for each data member
should also be defined in this class.
Note: While getting the value for social group, restrict the user to only enter ‘f’ or ‘F’ for female, ‘m’ or’ M’ for male
and ‘k’ or ‘K’ for kids.
3) Create another class named Mov_Que (List class); to create a queue for each movie, this class should define three
variables, Front pointer, Rear pointer and counter. The class should also define the following functions:
a) Constructor(): Default constructor of the class.
b) Destructor(): Destructor to destroy the memory gained by the use of new operator.
c) add_Ticket(): This method should enter the new ticket purchased at the rear.
d) Total_Visitors(): This method should return the total number of visitors of movie.
e) Total_Revenue(): This method should return the total revenue of the movie.
f) Popularity(): This method should check the popularity of the movie amongst social group, whether the movie is
popular among males, females or kids.
4) In main() function of the program, create three objects of the class Mov_Que which will act like three
counters at cinema. These objects should be able to perform all the required functionalities mentioned in
the question statement.
5) To get the idea about exact output of program, see Demo.wmv file attached with assignment file.


 

Final Solution Assignment No. 01 Spring 2013 CS201 Introduction to Programming

Please Do not copy paste its my orignal file
#include <iostream.h>

main()

{
// Declaring variables for input (x,y) and (x1,y1)
int a,b,c,d;
// Declaring variables for formula dx(x1 - x) and dy(y1 - y)
float m,x,y;

cout "Enter the X - Coordinate of the Starting point = ";
cin>> a;

cout "Enter the Y - Coordinate of the Starting point = ";

cin>> b;

cout "Enter the X - Coordinate of the Ending point = ";

cin>> c;

cout "Enter the Y - Coordinate of the Ending point = ";

cin>> d ;
// acording to formula dx(x1 - x)
x = c-a ;
// show message if the resualt (x1 - x)= 0
if (x==0)
{ cout "Line is parallel to Y - Axis ";
}
else
{
// show message if the resualt (y1 - y)= 0
y = d-b ;
if (y==0)
{ cout "Line is parallel to X - Axis ";
}
else
{
// show message if the resualt (dy/dx )= 1
m = y/x;
if (m==1)
{
cout "Line will make the 45 degree angle with the Horizon ";
}
else
{
// show message if the resualt dy/dx > 1
if (m>1)
{
cout "Line will travel more along Y- Axis And less along X- Axis" ;
}
// show message if the resualt dy/dx < 1
if (m<1)
{
cout "Line will travel more along X- Axis And less along Y- Axis" ;
}
}
}
}
}

 

Monday, April 22, 2013

Solution Of Assignment # 1 of CS403 of Spring 2013 Due Date 29/04/2013





Database Management System (CS403)
Assignment No.1
                                                                                                                      Total marks = 20
       Deadline Date: 29/04/2013
                              
Please carefully read the following instructions before attempting the assignment.

 Deadline
Your assignment must be uploaded before or on 29th April 2013.

Rules for Marking
It should be clear that your assignment will not get any credit if:
1. The assignment is submitted after due date
2. The assignment is copied
3. You are supposed to submit your assignment in .doc / Docx format. Any other formats like scan    images, PDF, Zip, rar, bmp etc will not be accepted.

For any query please contact: CS403@vu.edu.pk

Objectives
The objectives of this assignment are,
1.      Giving the idea of the most common tool used for designing database systems i.e. Data Flow Diagram. It is used to design systems graphically and expresses different details of system in different DFD levels.
2.      To become familiar with the flow of data between different processes and to hide complexities in any given system.

Assignment

Consider a real world scenario of a university system. We are going to develop a security information system for employees so that there may be no chances of error or illegal access of an employee record or account. To complete this system we will divide this whole project in small assignment chunks (probably 4 to 5) and will try to cover every phase of the database development life cycle from scratch to implementation (SQL Queries). Scenario of the Security information system is given below.

Scenario:
The top management of the university wants to computerize the university employee’s records for security reason. The security information system will comprise of three sub applications.

1.      Fingerprint system (deployed through a biometric device)
2.      Online Employee Record Management (ERM) that will be a web based application deployed on a central server and access able through LAN
3.      Live Activity Monitoring System (LAMS) deployed through security camera (CCTVs) installed on various location in university premises.

Detail of each application is given below:
Fingerprint system:
To achieve this task the management wants to fix an automated fingerprint identification system for employee’s attendance. This system automatically matches fingerprints against a database of known prints. Attendance system uses biometrics to guarantee the accuracy in reporting. Attendance system works by having an employee place their finger on a small scanner upon entering and exiting the office, the attendance record is stored in the database. This information can later be checked by the management to track the employee’s check in, checkout times and location as well.
Online ERM:
To guarantee security, the employee’s are provided with a web account. Employees are provided with the user name and password so that no one can access his / her record. Using their account, employees can mark attendance, apply for leave, apply for loan, manage his/her bank account or see salary slip. Employee can also generate a new password by using the “Forgot your password?” link on the login page.
Live Activity Monitoring System (LAMS):
To better enhance the security system, management wants to install the security cameras to monitor the employee’s activities more closely, to keep an eye on precious assets and properties of the university. With the help of security cameras unauthorized and illegal activities are controlled. The security cameras capture images and record videos. These records are stored in the database.  The management can view all the details about their employees at any time to monitor the productivity and job related skills of employees. Further than case use the information to ensure that he/she might not indulge in any immoral activities.
Note that all the three applications share a central database (as shown in figure-1), deployed on a dedicated database server.


Task Description:

This Assignment is starting phase and in this assignment you will focus only on the tasks given below:

Task-1:
Part1. You are required to identify all the processes in the system.   (4 Marks)
Part2. Find out all the external entities interacting with the system. (4 Marks)

Task-2:
Part1. Create a Context level DFD                                                     (4 Marks)
Part2. Create Detailed DFD of the system                                           (8 Marks)

Note: In Task-2 Part2 decompose the DFD up to level-1 i.e. after context draw level-0 and then further decompose up to level-1


Important things to consider:

Ø  As happens in real world that everyone visualize a problem in different way so the solutions of all students should be according to their own thinking not taken from some source.
Ø  As this is preliminary phase of our system so it is recommended that you identify as much processes and their relationships as you can (some of them may be eliminated in coming assignments).


Good Luck

Saturday, April 20, 2013

Business & Technical English: Eng201 Assignment No. 01 Spring 2013


 Business & Technical English: Eng201

Spring 2013           
Assignment No. 01
Total Marks: 15
Lesson No. 1-9
Due Date: 25-04-2013
   Objectives:
  • To assess students’ knowledge of the subject and ability to write objectives in business and technical environment

Instructions
  1. Late assignments will not be accepted.
  2. If the file does not run properly, it will be marked zero.
  3. Plagiarism will never be tolerated. Plagiarism occurs when a student uses work done by someone else as if it was his or her own.
  4. If any assignment is found copied work, no marks will be awarded and the case may be referred to the academics for disciplinary action.
  5. No assignment will be accepted through e-mail.
  6. The font color should be preferably black and font size should be 12 Times New Roman.

Question No. 1:                                                                                             (10)
You have set up a small hardware Company named Tivoli Storage Manager (TSM) which has successfully survived in its 1st year. Now you want to set objectives of this company for the next ten years. You are required to write objectives both implicit and explicit to maintain the success rate of your company.
Question No. 2:                                                                                              (5)
Choose the correct option from the following:                                                      
1. Documents should be created for -------------- purposes or goals in a professional environment that both the writer and the reader would readily agree on.
  • implicit
  • explicit
  • illicit
  • None of the above
2. If people have to communicate effectively, they must choose the right method and do so in a manner that builds ------------ relationships.
  • negative
  • neutral
  • positive
  • All of the above
  1. 3.      Communication is institutionalized under many different names at different universities and in various countries, including -----------.
  • media studies
  • biological talk
  • gossip
  • All of the above
  1. 4.      Generally, human communication is concerned with the making of ---------- and the exchange of understanding about human development.
  • cries
  • sounds
  • meaning
  • rhetoric
  1. 5.      ---------- is the interference with effective transmission and reception of a message.
  • Noise
  • Pollution
  • Sound
  • Obstacle


Assignment No. 01 SEMESTER Spring2013 CS602- Computer Graphics

Assignment No. 01
SEMESTER Spring2013
CS602- Computer Graphics

Total Marks: 20
Due Date: 25/04/2013

Instructions

Please read the following instructions carefully before solving & submitting assignment:

It should be clear that your assignment will not get any credit (zero marks) if:

The assignment is submitted after due date.
The submitted assignment does not open or file corrupt.
The assignment is full or partially copied (from other student or ditto copy from handouts or internet).
Student ID is not mentioned in the assignment File or name of file is other than student ID.
The assignment is not submitted in .doc (MS Word) format.



Uploading instructions
Your Submission must include:
 

MS Word file.

Objective
The objective of this assignment is


To make you understand the concept and application of computer graphics concept behind the scene.
To give you some workout of latest technologies.

Important Requirements and Instructions:

You are not allowed to copy it from internet. In that case no marks shall be awarded.
Same assignment of two or more students shall be considered cheating case and they will get straight zero marks.
Assignment last date is April 25 2013.Any lame excuses will not be accepted. 
We will not accept assignment through email in any case. Be careful.


For any query about the assignment, contact at cs602@vu.edu.pk(mailto:cs602@vu.edu.pk)

GOOD LUCK
                                                                                                            

Answer the following questions. Each question carry equal marks:

Question 1                                                                                                                                                        //4 marks

Suppose you want to see a 3D cartoon movie of 10 second length in RGB mode having a resolution of 1024 x786 at 60 Hz. If clip is organized in a way that after every refresh cycle a new frame is to be loaded then how much data has to be moved by the video card for 10 seconds to refresh the whole screen?

Question 2                                                                                                                                                       //6 marks

Write an assembly program to write character ‘b’ at 20th column and 25th row using direct memory access. Use the following information:

Text mode: 3

Video graphics memories address: 0b8000h


Question 3                                                                                                                                                       //5 marks      

Following is the list of smart phones. Mention the names of hardware which are used in these smart phones for Graphics.

Device Name

GPU’s

Samsung Galaxy S II

HTC Sensation

IPhone 4

Galaxy Nexus

Motorola Xoom


Question 4                                                                                                                                                       //5 marks      


Fill in the following table according to the graphics adapters properties.

In case when an adapter is an extension of previous one, only write its new resolutions it provides while in other blanks only write “yes”.


ADAPTER NAME


MODE


COLOR

         NO OF BIT’s


LIMITATION

(only one for each)

TEXT


GRAPHICS


TEXT


GRAPHICS

Monochrome Adapter

Color Graphics Adapter

Multicolor Graphics Adapter

Extended Graphics Adapter

Enhanced Graphics Adapter
                                                                                                                             

Note: Your explanation must justify enough for given marks for each part.