Write a function named is Even that takes an integer argument n and returns a boolean value. Implement the function so that it returns true when n is even and false when n is odd. Write test code with assertions to verify that you implemented the function correctly A person\'s initials is the first letter of their first name, followed by a period, followed by the first letter of their last name, followed by a period. For example, the initials for David Turner are D.T. Write a program that prompts the user for a first name and then prompt the user for a last name Have the program display the user\'s initials. As part of your solution, define a function named initials, which takes 2 arguments: the first name and the last name. The function returns the person\'s indials as a string Because the function arguments don\'t need to be changed and are complex data types, you should pass them into the function as const references. Implement a function named random lnteger that takes as arguments a lower bound a and an upper bound b of an interval (a, b). The function computes and returns a random integer that falls inside this interval. Write a program that prompts the user for a lower bound and an upper bound After the user inputs these values, the program should call your random integer function to get a random integer between the lower and upper bounds. The program displays this value to the user and then terminates. Submit your work by sending the url of your Cloud9 workspace to the teaching assistant and CC the instructor. The subject line of your email should be 201 Assignment; Functions. Example quiz questions Any of the above or similar problems. Implement a function that determines if an integer is lucky. The function returns true if the number passed into it is divisible by 7 and not by 13; otherwise it returns false. A declaration of the function is shown below.
(A)
boolean isEven(int n)
{
if(n%2==0)
{
return true;
}
else
{
return false;
}
}
(B)
#include<iostream.h>
#include<string.h>
void main()
{
String first_name;
String last_name;
cout<<\"Enter Firstname\ \";
cin>>first_name;
cout<<\"Enter Lastname\ \";
cin>>last_name;
String initial=initials(first_name,last_name);
cout<<\"Initials :\"<<initial;
}
String initials(String &fname,String &lname)
{
String finitial=fname.substr (0,1);
String linitial=lname.substr (0,1);
strcat (finitial,\".\");
strcat (finitial,linitial);
return finitial;
}
(C)
#include<iostream.h>
#include<math.h>
void main()
{
int lower_bound;
int upper_bound;
cout<<\"Enter Lower bound\ \";
cin>>lower_bound;
cout<<\"Enter Upper bound\ \";
cin>>upper_bound;
int randomno=randomInteger(lower_bound,upper_bound);
cout<<\"Random integer between given interval is \"<<randomno;
}
int randomInteger(int lbound,int ubound)
{
randomint = lbound + rand() % ubound;
return randomint;
}