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

Search This Blog

Search with our Site

Custom Search

Thursday, January 13, 2011

Software Engineering-1 (CS504) Assignment # 4

Software Engineering-1 (CS504)
Assignment # 4
  Total marks = 20
                                                                                       Deadline Date = 19-01-2011

Please carefully read the following instructions before attempting the assignment.

Rules for Marking
It should be clear that your assignment would not get any credit if:

  • The assignment is submitted after due date.
  • The submitted assignment does not open or file is corrupt.
  • The assignment is copied. Note that strict action would be taken if the submitted assignment is copied from any other student. Both students will be punished severely.

1)      You should concern recommended books to clarify your concepts as handouts are not sufficient.
2)      You are supposed to submit your assignment in .doc format. Any other formats like scan images, PDF, Zip, rar, bmp, docx etc will not be accepted
3)      You are advised to upload your assignment at least two days before Due date.
4)      This assignment file comprises of Two (2) pages.


Important Note: 

Assignment comprises of 20 Marks. Note that no assignment will be accepted after due date via email in any case (whether it is the case of load shedding or emergency electric failure or internet malfunctioning etc.). Hence, refrain from uploading assignment in the last hour of the deadline, and try to upload Solutions at least 02 days before the deadline to avoid inconvenience later on.

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


Question No. 1                                                                                               Marks [10]


This is a sample code for guessing your personality using if-else statement.

char ch;
cout<<”Type a character in small letter [a-z] :”;
cin>>ch;
If (ch= =’l’)
            cout<<”You are a Lucky person”;
else If (ch= =’a’ || ch==’z’)
            cout<<”You are an extremist (sorry to say)”;
else If (ch= =’u’)
            cout<<”You are Unlucky, wish you good luck.”;
else
            cout<<”You are Unpredictable person”;

Your have to write a program that performs EXACTLY the same task using switch-statement.

Note: The code must be non-cryptic and easy to read.

Question No. 2                                                                                                Marks [10]

Following code generates Fibonacci series for given limit number.
void main()
{
    unsigned int i=0,j=0,sum=1,num;
    cout<<”Enter the limit for the series ";
    cin>>num;
    while(sum<num)
    {
       cout<<sum<<”\n”;
       i=j;
       j=sum;
       sum=i+j;
                      
    }
   
    getch();  
}
Modify the code such that the same objective is achieved by using Modular approach.

Hint: Define a function Fibonacci that takes series limit as input and prints the results.

No comments:

Post a Comment