Software Enggnering Lab File

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

SOFTWARE ENGGNERING

LAB FILE
ICT-260
Submitted in partial fulfilment of the requirements for the award of the degree of
B.Tech.
in
Computer Science Engineering

Submitted to: Submitted by:


DR. Priyanka Bhutani Name – Suraj Mishra
Enrollment No. - 04316403221

UNIVERSITY SCHOOL OF INFORMATION COMMUNICATION AND


TECHNOLOGY GURU GOBIND SINGH INDRAPRASTHA UNIVERSITY
Program -1

1) WAP to calculate lines of code of a given program from the text file

Code :

#include <iostream>
#include <fstream>
#include <string>

using namespace std;

int countLinesOfFile(const string& filename) {


ifstream file(filename);
if (!file.is_open()) {
cerr << "Error opening file: " << filename << endl;
return -1;
}

int lineCount = 0;
string line;
while (getline(file, line)) {
if (!line.empty()) {
lineCount++;
}
}

file.close();
return lineCount;
}

int main() {
string filename;
cout << "Enter the file name: ";
cin >> filename;

int lineCount = countLinesOfFile(filename);


if (lineCount != -1) {
cout << "Number of lines in the file: " << lineCount << endl;
}

return 0;
}

Output :
Program -2

2) WAP to implement function Point method of software size estimation

Code :

#include <iostream>

using namespace std;

double calculateFunctionPoints(int numInputs, int numOutputs, int numInquiries, int numFiles, int
numInterfaces) {
// Function Point weights for each type
const double inputWeight = 3.0;
const double outputWeight = 4.0;
const double inquiryWeight = 3.5;
const double fileWeight = 4.5;
const double interfaceWeight = 4.0;

// Calculate the Unadjusted Function Point count


double unadjustedFP = (numInputs * inputWeight) + (numOutputs * outputWeight) + (numInquiries *
inquiryWeight) +
(numFiles * fileWeight) + (numInterfaces * interfaceWeight);

// Adjust the Unadjusted Function Point count based on complexity level


double complexityFactor;
cout << "Enter the complexity factor (0.65 - 1.35): ";
cin >> complexityFactor;
double adjustedFP = unadjustedFP * complexityFactor;

return adjustedFP;
}

int main() {
int numInputs, numOutputs, numInquiries, numFiles, numInterfaces;

cout << "Enter the number of inputs: ";


cin >> numInputs;
cout << "Enter the number of outputs: ";
cin >> numOutputs;
cout << "Enter the number of inquiries: ";
cin >> numInquiries;
cout << "Enter the number of files: ";
cin >> numFiles;
cout << "Enter the number of interfaces: ";
cin >> numInterfaces;

double functionPoints = calculateFunctionPoints(numInputs, numOutputs, numInquiries, numFiles,


numInterfaces);
cout << "Function Points: " << functionPoints << endl;

return 0;
}
Output :

Program -3

3) WAP to implement Cocomo -1 model of software size estimation

Code :

#include <iostream>

using namespace std;

double calculateEffort(double size, double a, double b, double c) {


return a * pow(size, b) * c;
}

double calculateDevelopmentTime(double effort, double d, double e, double f) {


return d * pow(effort, e) * f;
}

double calculateStaffCount(double effort, double developmentTime) {


return effort / developmentTime;
}

int main() {
double size, a, b, c, d, e, f;

cout << "Enter the estimated size (in KLOC): ";


cin >> size;

cout << "Enter the value of a: ";


cin >> a;
cout << "Enter the value of b: ";
cin >> b;
cout << "Enter the value of c: ";
cin >> c;

cout << "Enter the value of d: ";


cin >> d;
cout << "Enter the value of e: ";
cin >> e;
cout << "Enter the value of f: ";
cin >> f;

double effort = calculateEffort(size, a, b, c);


double developmentTime = calculateDevelopmentTime(effort, d, e, f);
double staffCount = calculateStaffCount(effort, developmentTime);

cout << "Effort (person-months): " << effort << endl;


cout << "Development Time (months): " << developmentTime << endl;
cout << "Staff Count: " << staffCount << " persons" << endl;

return 0;
}

Output :

You might also like