ITC2
ITC2
ITC2
IT218
(ELECTIVE 3)
1
NAME:Ducog,Jhory A DATE: 11/13/22
COURSE: BSIT-2
SECTION:2
Create a controller class, "PrintSequence" that will generate a view according to the descriptions
provided in each methods. Then, in your newly created controller create 3 different methods,
namely :
1.) MarioFlagPole
- Accepts 1 argument, which is the Flag Pole Size.
- The segment that handles your argument should only accept numbers.
Example:
Argument : 5
Output :
2.) BoxedFrame
- Accepts 2 arguments
- The segments that refers to your arguments should only accept numbers.
Arguments:
1 - Row Size
2 - Column Size
Examples:
Arguments:
1=8
2=5
Arguments:
1=8
2=6
Arguments:
1=8
2=7
Arguments:
1=5
2=8
3.) HoneyComb
- Accepts 2 arguments
- The segments that refers to your arguments should only accept numbers.
Args:
1 - Row Size
2 - Column Size
Example :
Arguments :
1=1
2=1
Arguments :
1=1
2=2
Arguments :
1=2
2=2
Note: The following rubrics/metrics will be used to grade students’ output in the Technical
Summative Assessment 1.
1. MarioFlagPole
<?php
for($i=1; $i<=5; $i++)
{
for($j=5; $j>=1; $j--)
{
if($j > $i)
echo " ";
else
echo $j;
}
echo "<br>";
}
?>
2. BoxedFrame
<?php
$size = 8;
for($i = 0; $i < $size; $i++) {
for($j = 0; $j < $size; $j++) {
if($i === 0 || $i === $size - 1) {
echo "*";
}
else {
if($j === 3 || $j === $size - 1) {
echo "*";
}
else {
// print star only in first and last position row
if($j === 0 || $j === $size - 1) {
echo "*";
}
else {
// use for space
echo " ";
}
}
}
}
echo "<br>";
}
?>
3. HoneyComb
<?php
// First Part
for($i=2; $i<=5; $i++)
{
for($j=5; $j>=1; $j--)
{
if($i == $j)
echo $j;
else
echo " ";
}
for($k=2; $k<=5; $k++)
{
if($i == $k)
echo $k;
else
echo " ";
}
echo "<br>";
}
// Second Part
for($i=4; $i>=2; $i--)
{
for($j=5; $j>=1; $j--)
{
if($i == $j)
echo $j;
else
echo " ";
}
for($k=2; $k<=5; $k++)
{
if($i == $k)
echo $k;
else
echo " ";
}
echo "<br>";
}
?>