Part 1 Write the pseudocode and create test data for a method to determine if a
ID: 3673528 • Letter: P
Question
Part 1
Write the pseudocode and create test data for a method to determine if a number even or odd.
number
result
Part 2
Write the pseudo code for exercise :Write a program that an integer,if the integer is greater than too or between 50 and 75(inclusive)then output yes. Otherwise ,output no. your program should use an if else statement along with&&(and)!!(0r)relational operation
example of numbers that would result in an output of yes 101,50,75,55,70,71,250
example of numbers that would result in an output of no 40,76,100,80,10, -50 .0 101,50,75,55,70,71,250
Part3
Write the pseudocode to determine the credit card issuer with the following requirements:
Credit begins with
Card Provider/Issuer
3
American Express
4
Visa
5
MasterCard
6
Discover
other
Specialty cards
number
result
Explanation / Answer
part 1
BEGIN PSEUDOCODE
function even_odd(input_value)
begin
x = input_value mod 2;
if x == 0 then
return true;
else
return false;
end
END PSEUDOCODE
True::It indicates Number is even
False:: It indicates Number is odd
Part 2
function number(input_value)
begin
if(value>100||(value>=50&&value<=75))
Print "Yes";
else
Print "No";
end
Part 3
function getCreditCardType(accountNumber)
{
//start without knowing the credit card type
var result = "unknown";
//first check for MasterCard
if (/^5[1-5]/.test(accountNumber))
{
result = "mastercard";
}
//then check for Visa
else if (/^4/.test(accountNumber))
{
result = "visa";
}
//then check for AmEx
else if (/^3[47]/.test(accountNumber))
{
result = "American Express";
}
else{
result = "Speciality cards";
}
return result;
}