Sponsored Links


Results 1 to 3 of 3

Thread: Software Engineering-1 (CS504) Assignment # 4 solution fall 2010

  1. #1
    Administrator Xpert's Avatar
    Join Date
    May 2010
    Location
    Jhelum
    Posts
    6,239

    Thumbs up Software Engineering-1 (CS504) Assignment # 4 solution fall 2010

    Sponsored Links1


    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.

    Code:
    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.
    Code:
    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.

    Sponsored Links

  2. #2
    Administrator Xpert's Avatar
    Join Date
    May 2010
    Location
    Jhelum
    Posts
    6,239

    Icon14

    Final solution of this assignment please find in the code
    Solution 1
    Code:
    #include <iostream>
    using namespace std;
    main()
    {
    char ch;
    cout << "Type a character in small letter [a-z] :";
    cin >> ch;
    
    switch(ch)
    {
    case 'l':
    {
    cout<<"You are a Lucky person";
    break;
    }
    case 'a':
    case 'z':
    {
    cout<< "You are an extremist (sorry to say)";
    break;
    }
    case 'u':
    {
    cout<<"You are Unlucky, wish you good luck.";
    break;
    }
    default:
    {
    cout<<"You are Unpredictable person";
    break;
    } 
    } 
    system("pause");
    }
    Solution 2
    Code:
    #include <iostream>
    using namespace std;
    void Fibonacci(int,int,int,int);
    main()
    {
    unsigned int i=0,j=0,sum=1,num;
    
    cout << "Enter the limit for the series ";
    
    cin >> num;
    Fibonacci(num,i,j,sum);
    system("pause");
    }
    void Fibonacci(int num,int i,int j,int sum)
    {
    cout << sum << endl;
    i = j;
    j = sum;
    sum = i + j;
    
    if (sum < num)
    Fibonacci(num,i,j,sum);
    
    }

  3. #3
    Junior Member
    Join Date
    May 2010
    Posts
    1
    Thanx a lot

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 11-30-2013, 09:22 PM
  2. Replies: 2
    Last Post: 02-04-2011, 04:00 AM
  3. Replies: 5
    Last Post: 01-11-2011, 09:40 PM
  4. Replies: 2
    Last Post: 11-24-2010, 04:29 AM
  5. CS504 Software Engineering 1 first assignment date extended fall 2010
    By Xpert in forum Virtual University Announcenments
    Replies: 0
    Last Post: 11-09-2010, 03:40 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
-: Vuhelp Disclaimer :-
None of the files shown here are hosted or transmitted by this server. The links are provided solely by this site's users. The administrator's or staff of Vuhelp.net cannot be held responsible for what its users post, or any other actions of its users. You may not use this site to distribute or download any material when you do not have the legal rights to do so. It is your own responsibility to adhere to these terms. If you have any doubts about legality of content or you have any suspicions, feel free to contact us.
Online Education | JhelumSoft