You are on page 1of 1

West Visayas State University

COLLEGE OF INFORMATION AND COMMUNICATIONS TECHNOLOGY


Luna St., La Paz, Iloilo City 5000
Iloilo, Philippines
* Trunkline: (063) (033) 320-0870 loc. 1403 * Telefax No.: (033) 320-0879
Acc. No.: M2700903PM
* Website: www.wvsu.edu.ph * Email Address: cict@wvsu.edu.ph
PHI-18939-2-QM

Activity 1
Instructions:
The filename of this activity is Activity1 – (Complete name). Then save this activity on the
Google Drive. Place your code at the end of these problem.

1. Write a program that produces the following output:


**********************************
* Programming Assignment 1 *
* Computer Programming 2*
* Author: Your Complete Name *
* Due Date: Date Today*
**********************************
2. Consider the following program segment:

public class Exercise2


{
public static void main(String[] args)
{
//variable declaration
//executable statements
}
}
a. Write Java statements that declare the following variables: num1, num2, and num3, and
average of type int.
b. Write Java statements that store 125 into num1, 28 into num2, and -25 into num3.
c. Write a Java statement that stores the average of num1, num2, and num3 into average.
d. Write Java statements that output the values of num1, num2, num3, and average.
e. Compile and run your program.

3. Consider the following program segment:

public class Exercise3


{
public static void main(String[] args)
{
//variable declaration
//executable statements
}
}

Repeat the instruction on Exercise 2 by declaring num1, num2, and num3, and average of type
double. Store 75.35 into num1, -35.56 into num2, and 15.76 into num3.

You might also like