Friday, July 8, 2016

IDP2 - Activity #3

GUI:


Source Code:

Option Explicit

Dim StrHeight As Integer
Dim StrWidth As Integer
Dim FormHeight As Integer
Dim FormWidth As Integer


Private Sub Form_Load()
    StrHeight = Label1.Height
    StrWidth = Label1.Width
    
    FormHeight = Form1.ScaleHeight
    FormWidth = Form1.ScaleWidth
    
    Timer1.Enabled = True
    Timer2.Enabled = False
    
    Timer1.Interval = 50
    Timer2.Interval = 50
    
    Call ResetStr
End Sub

Private Sub ResetStr()
    Label1.Top = 0
    Label1.Left = 0
End Sub

Private Sub Timer1_Timer()
    If Label1.Left <= (FormWidth - StrWidth) Then
        Label1.Left = Label1.Left + 100
    Else
        Timer1.Enabled = False
        Timer2.Enabled = True
    End If
End Sub

Private Sub Timer2_Timer()
    If Label1.Top <= (FormHeight - StrHeight) Then
        Label1.Top = Label1.Top + 50
    Else
        Timer2.Enabled = False
        'Timer3.Enabled = True
    End If
End Sub

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

Objective:

Append the program and add the functionality to complete the cycle of the moving label. Make sure that the label will keep on rotating until such time the user interferes and stop the program.

Tuesday, June 28, 2016

Input Stream

Activity #2


Problem 1:

Write a program to require the user to input a string. Process the string by counting the total number of vowels and consonants in the string. For additional reference, please visit http://www.tutorialspoint.com/java/java_strings.htm , http://bit.ly/28TBVbB


VALIDATION

Sample Output #1:
Enter a string: Chance favors the prepared minds.

Vowels: 9
Consonants: 19

Sample Output #2:
Enter a string: The quieter you become, the more you are able to hear!

Vowels: 22
Consonants: 20

Sample Output #3:
Enter a string: Swing your rope down low.

Vowels: 7
Consonants: 13

------------------------------------------------------------------------------------------------------
Problem 2:

Write a program to require a string input from the keyboard. Using a loop structure, read the string backwards and display the result.

Sample Output #1:
Enter a string: Government
tnemnrevoG


Sample Output #2:
Enter a string: Aliens
sneilA

Sample Output #3:
Enter a string: Absurd
drusbA





Note: Once you're done, email the source code to adichosa@gmail.com. Use as subject <SECTION>-Act2-<fullname>. Deadline is on or before 12PM for Solus and 3PM for GNOME. TODAY!!!

Sunday, May 22, 2016

FIND THE SECOND LARGEST NUMBER IN THE ARRAY

/**
* find the second largest integer in an array.
* @param ia an array of integers
* @return the second largest number in ia
*/
private static int secondLargest(int[] ia)
{
int first_largest=0;
int second_largest=0;

//find the first largest
for (int i=0; i<ia.length; i++){
if (ia[i] > first_largest)//determine first the first largest so that we can identify the second largest
first_largest=ia[i];

}
//find the second largest
for (int i=0; i<ia.length; i++){
if (ia[i] > second_largest && ia[i]<first_largest) //check if it is the second largest
second_largest=ia[i];

}

return second_largest;
} //secondLargest

Tuesday, December 9, 2014

C++ Practice Exercise

Write a C++ program that will display the calculator menu.

The program will prompt the user to choose the operation choice (from 1 to 5). Then it should ask the user to input two integer values

for the calculation.

See the sample below.


MENU
  1. Add
  2. Subtract
  3. Multiply
  4. Divide
  5. Modulus

Enter your choice: 1

Enter your two numbers: 12 15

Result: 27
 
Continue? y




 
The program also asks the user to decide whether he/she wants to continue the operation. If he/she input ‘y’, the program will prompt

the user to choose the operation gain. Otherwise, the program will terminate.

Wednesday, November 26, 2014

COMPRO8 Activity #4

Things That Needs To Be Done Today
 
Study PHP Arrays in http://www.w3schools.com/php/php_arrays.asp

Activity #4

Problem:
Write a Web App to accept a string input (sentence) using a <textarea> element. During form submission, store each word of the sentence in an array named $words[].


Sample Output:

Web Interface

Enter a sentence: 

Result: Each word will be stored as element in the array.


words
Whatdidthefoxsay?Tingtingtingting...

Tuesday, September 30, 2014

Review - Activity #1

Sept 30, 2014
COMPRO2 - Excellence and Integrity

Problem #1
Write a program to compute the salary of an employee using the formula : salary=hours worked X hourly rate. Require an input for hours worked and hourly rate using the keyboard.

Sample output:
Enter hours worked: 20
Enter hourly rate: 70.50
Salary: 1410.0


Problem #2
Write a program to accept the gender of a person; 'M' for male and 'F' for female. Display an appropriate message based on gender.

Sample output:

Validation #1:
What is your gender? M
Good morning Sir!

Validation #2:
What is your gender? F
Good morning Ma'am!

Validation #3:
What is your gender? Male
Invalid gender!

SEND YOUR SOURCE CODE TO: adichosa@gmail.com
SUBJECT: <section>-COMPRO2-LACARLOTA-<fullname>


Monday, September 29, 2014

LOL

Watch the official trailer of "The Walking Dead" season 5. If you can!