You are on page 1of 3

Visual Programming – Week 2 Activities

Due Date: February 13, 2023, Tuesday, 2:00 PM

General Instructions:

In answering and submitting your activities you can follow and select one of the choices below:

1. Use a document editor like Microsoft Word or WPS Office, copy paste the questions, instruction or
format provided.
2. Use a short bond paper and blue ball pen then paste all pictures in a word document by using
Microsoft Word or WPS Office.

Notes:

• Filename for the document should be: FamilyName_ActivitiesWeek2


• Make sure to indicate your Name & Section, and the Activity Name on the upper right corner of
the bond paper.

Part III - Independent Practice:

WORKSHEET 2 – Code Snippets

Task: Given the following code snippets below, provide the output.

Code Snippet Output


String: Hello! World
class Main { Length: 12
public static void main(String[] args) {

String greet = "Hello! World";


System.out.println("String: " + greet);

int length = greet.length();


System.out.println("Length: " + length);
}
}
Strings first and second are equal: true
class Main { Strings first and third are equal: false
public static void main(String[] args) {

String first = "java programming";


String second = "java programming";
String third = "python programming";

boolean result1 = first.equals(second);


System.out.println("Strings first and second are
equal: " + result1);

boolean result2 = first.equals(third);


System.out.println("Strings first and third are
equal: " + result2);
}
}

Part V – Performance Task:

Instruction:

Your task now is to create a runnable Java Program that uses the concepts of Java Characters, Strings,
and Numbers.

Task:

Write a Java program to check whether a given string ends with the contents of another string.

Sample Output:

"Python Exercises" ends with "se"? false "Python


Exercise" ends with "se"? true

You might also like