Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ Personal Software Process The Personal Software Process (PSP) is a software

ID: 3839431 • Letter: C

Question

C++ Personal Software Process

The Personal Software Process (PSP) is a software development “exercise” intended to help software engineers understand their own personal strengths and weaknesses in the software development process. At its heart, it consists of doing some estimates before you start work (how long will design take, how many bugs do you think you’ll write, etc.), keeping detailed records while you work, and then comparing reality to your estimates. Doing so helps you understand where your weaknesses (if you estimate 10 bugs but end up writing 100) and strengths are.

More info on the PSP: http://www.sei.cmu.edu/reports/00tr022.pdf

So what I want you to do is just to fill in my PSP spreadsheet for my program.

I just needs to make sense so you can just make things up for estimates.

Here is my code:

#include <iostream>
#include <string>

using std::string;

int sum_evens(unsigned int n);

int multiply(unsigned int a, unsigned int b);

int smallest(int* arr, int length);

bool is_palindrome(string s);

bool is_element_of(int i, int* array, int length);

bool is_subset(int* a, int length_a, int* b, int length_b);

int main() {
using std::cin;
using std::cout;

int a; // testing sum_evens
cout << "-- Sum of all even numbers " << std::endl;
cout << "Enter any number" << std::endl;
cin >> a;
cout << sum_evens(a) << std::endl;

int aa; //multiplication using addition.
int bb;
cout << "Enter two integers to multiply" << std::endl;
cin >> aa >> bb;
cout << multiply(aa,bb) << std::endl;

int c[] = {3,5,2,1,5};
cout << smallest(c,5) << std::endl;

//tests is_palindrome(string s);
string d;
cout << "-- Testing if a word is a palindrome --"
cout << "Enter a word" << std::endl;
getline(cin, d);
if(is_palindrome(d)== true)
cout << d << " is a palindrome." << std::endl;
else
cout << d << " is not a palindrome." << std::endl;

// tests functions 7 and 8
int x[] = {5, 2, 1};
int y[] = {1,2,5,1,2};
bool istrue = is_subset(x,3,y,5);
cout << "int x[] = {5,2,1} " << std::endl;
cout << "int y[] = {1,2,5,1,2} " << std::endl;
if(istrue)
cout << "All elements of array x are in array y" << std::endl;
else
cout << "One or more elements of array x are not in array y" << std::endl;
}

int sum_evens(unsigned int n){
if(n == 0)
return 0;
if(n % 2 == 0)
return n + sum_evens(n - 2);
else
return sum_evens(n - 1);
}

int multiply(unsigned int a, unsigned int b){
if(b == 0)
return 0;
if(b == 1)
return a;
else
return a + multiply(a, b - 1);

}

int smallest(int* arr, int length){
if(length == 1)
return arr[0];
length--;
return smallest(arr + (arr[0] > arr[length]) , length);

}

bool is_palindrome(string s){
if(s.length() < 2)
return true;
if(s[0] != s[s.length() - 1])
return false;

return true;
  
}

bool is_element_of(int i, int* array, int length){
if(length < 0)
return false;
if(array[length] == i)
return true;
else
return is_element_of(i, array, length - 1);
  
}

bool is_subset(int* a, int length_a, int* b, int length_b){
if(length_a < 0)
return true;
if(!is_element_of(a[length_a], b, length_b))
return false;
else
return is_subset(a, length_a - 1, b, length_b);
return true;
}

-------------------------------------------------

And below is the spreadsheet I ask you to fill in.

(fields that you should fill in are highlighted in light blue)

Thank you in advance and I really appreciate your help!

Final LOC/Hour Program Size (LOC) Created A Lines Final LOC Time in Phase (min) Planning Design Code Compile Test Postmortem TOTAL Defects injected Planning Design Code Compile Test TOTAL Estimate #DIV/0! Estimate (estimated) (estimated) Estimate Estimate Actual #DIV/0! Actual (counted) (counted) (counted) Actual Actual

Explanation / Answer

#include <iostream>
#include <string>

using std::string;

int sum_evens(unsigned int n);

int multiply(unsigned int a, unsigned int b);

int smallest(int* arr, int length);

bool is_palindrome(string s);

bool is_element_of(int i, int* array, int length);

bool is_subset(int* a, int length_a, int* b, int length_b);

int main() {
using std::cin;
using std::cout;

int a; // testing sum_evens
cout << "-- Sum of all even numbers " << std::endl;
cout << "Enter any number" << std::endl;
cin >> a;
cout << sum_evens(a) << std::endl;

int aa; //multiplication using addition.
int bb;
cout << "Enter two integers to multiply" << std::endl;
cin >> aa >> bb;
cout << multiply(aa,bb) << std::endl;

int c[] = {3,5,2,1,5};
cout << smallest(c,5) << std::endl;

//tests is_palindrome(string s);
string d;
cout << "-- Testing if a word is a palindrome --"
cout << "Enter a word" << std::endl;
getline(cin, d);
if(is_palindrome(d)== true)
cout << d << " is a palindrome." << std::endl;
else
cout << d << " is not a palindrome." << std::endl;

// tests functions 7 and 8
int x[] = {5, 2, 1};
int y[] = {1,2,5,1,2};
bool istrue = is_subset(x,3,y,5);
cout << "int x[] = {5,2,1} " << std::endl;
cout << "int y[] = {1,2,5,1,2} " << std::endl;
if(istrue)
cout << "All elements of array x are in array y" << std::endl;
else
cout << "One or more elements of array x are not in array y" << std::endl;
}

int sum_evens(unsigned int n){
if(n == 0)
return 0;
if(n % 2 == 0)
return n + sum_evens(n - 2);
else
return sum_evens(n - 1);
}

int multiply(unsigned int a, unsigned int b){
if(b == 0)
return 0;
if(b == 1)
return a;
else
return a + multiply(a, b - 1);

}

int smallest(int* arr, int length){
if(length == 1)
return arr[0];
length--;
return smallest(arr + (arr[0] > arr[length]) , length);

}

bool is_palindrome(string s){
if(s.length() < 2)
return true;
if(s[0] != s[s.length() - 1])
return false;

return true;
  
}

bool is_element_of(int i, int* array, int length){
if(length < 0)
return false;
if(array[length] == i)
return true;
else
return is_element_of(i, array, length - 1);
  
}

bool is_subset(int* a, int length_a, int* b, int length_b){
if(length_a < 0)
return true;
if(!is_element_of(a[length_a], b, length_b))
return false;
else
return is_subset(a, length_a - 1, b, length_b);
return true;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote