Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Software Engineering-1 (CS504) Assignment # 4 solution fall 2010
#1
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
[FONT=&quot]
[/FONT] 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.
Reply
#2
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); }
Reply
#3
Thanx a lot
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  CS301 Assignment # 4 Due Date: 02-Feb-2016 Vuhelper 0 2,319 02-03-2016, 05:38 PM
Last Post: Vuhelper
  CS703 – Advanced Operating Systems Assignment No.3 solution January 2016 Vuhelper 0 5,904 01-23-2016, 09:58 PM
Last Post: Vuhelper
  CS601 Data Communication Assignment No. 03 Solution 23rd January 2016 Vuhelper 1 1,925 01-23-2016, 06:09 PM
Last Post: Vuhelper
  CS403 Assignment No. 03 Solution 23rd January 2016 Vuhelper 2 1,161 01-23-2016, 03:18 PM
Last Post: Vuhelper
  CS506 Web Design and Development Assignment no 3 Solution 3rd January 2016 Vuhelper 0 2,237 01-23-2016, 03:16 PM
Last Post: Vuhelper
  CS724 Software Process Improvement Assignment No 01 Solution 20th January 2016 Vuhelper 0 1,962 01-20-2016, 06:26 PM
Last Post: Vuhelper
  CS711 Software Design Assignment No 01 Solution Due Date Feb 12, 2016 Vuhelper 0 1,660 01-20-2016, 06:24 PM
Last Post: Vuhelper
  CS709 Formal Methods for Software Engineering Assignment No 01 Solution January 2016 Vuhelper 0 1,793 01-20-2016, 06:22 PM
Last Post: Vuhelper
  cs703 assignment no 3 Solution 20th January 2016 Vuhelper 0 1,696 01-20-2016, 06:20 PM
Last Post: Vuhelper
  CS704 Assignment No. 01 Solution January 2016 Vuhelper 0 4,794 01-20-2016, 06:19 PM
Last Post: Vuhelper

Forum Jump:


Users browsing this thread: 1 Guest(s)