Tuesday, February 16, 2010

Literature 2

Malacaste, Annelyn B.
II-BSIT
Literature 2

Title: GOD SEES THE TRUTH BUT WAITS
Author:
Name: Leo Tolstoy
Birth Date: August 28, 1828
Death Date: November 9, 1910
Place of Birth: Tula Province, Russia
Place of Death: Astapovo, Russia
Nationality: Russian
Occupations: novelist
Plot/Summary:
In the town of Vladimir, lived a young merchant named Ivan Dmitri Aksionov and lived with his family together.

One summer, he planned to go to Nizhny fair and he baded goodbye, his wife warned him that she had a bad dream for her husband-- she dreamt about Ivan that he returned from the town with hair of grey. But then, Ivan laughed as if he doesn't care.And again, he baded goodbye.

He travelled half way and met a merchant, there they put up at the same inn and slept. After a while he rose up for it wasn't his habit to sleep late and continued his journey.

Then suddenly, along the way, two soldiers in a troika stopped him, and baan asking questions.for the merchant he met halfway on his travel was found dead.

Ivan denied that he did not know anything about it but was imprisoned. His family knew about this, but then also suspected him as well as the police officers did.

26 years passed and another new prisoner met him named Makar Semyonich and after months, they knew each other. Ivan knew it was Makar who killed the merchant ago. but didn't speak or utter a word about it.

a fort-night came and Ivan heard some earth rolling under where the prisoners were sleeping. He went out and saw Makar. Makar told him not to tell a word about what he had witnessed or else he will kill him.

When they were led out to work, a soldier noticed a prisoner took of some earth off his boots. the soldier searched for escaping plans and found the tunnel.

Then, they asked each of them who knew about this but they denied for they knew they will be killed before the one who did it as Makar warned them. finally, the governor asked Ivan for he knew he was a just man. But then Ivan said it wasn't his right nor his will but God's to tell such name.

Night fell and Makar went to Ivan. He thanked him and felt sorry for what he had done to him a long time ago that made Ivan suffer for all this years. He sobbed as well as Ivan and said that the Lord will forgive you. Makar said that he will confess to the governor so that Ivan would be sent free--back to his home.

Ivan did not want to go out of prison for he has no family neither home to back to, rather, he waited for his last hour to come.

Inspite of what they've talked about, Makar Semyonich confessed his guilt. But when the order for Ivan Dmitri Aksionov's release came, he was already dead.

Setting:
Characters:
Theme:
The theme is forgiveness and triumph in times of tragedy. It also relates that we have to let God take care of everything and be assured that he knows the truth no matter what everybody else might think.

Thursday, February 4, 2010

LABEXERCISES_iT123B

package Entity;

/**
*
* @author Administrator
*/
public class Student {

public static String size() {
throw new UnsupportedOperationException("Not yet implemented");
}



private String name;
private String studesId;
private int age;
private String address;
private Course course;

public String getAddress() {
return address;
}

public void setAddress(String address) {
this.address = address;
}

public int getAge() {
return age;
}

public void setAge(int age) {
this.age = age;
}

public Course getCourse() {
return course;
}

public void setCourse(Course course) {
this.course = course;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getStudesId() {
return studesId;
}

public void setStudesId(String studesId) {
this.studesId = studesId;
}

public Student(String name, String studesId, int age, String address, Course course) {
this.name = name;
this.studesId = studesId;
this.age = age;
this.address = address;
this.course = course;
}

public Student() {
}



public String displayStudesmenu(){
return"\nName:"+name +";" +"Student ID:"+studesId +";" +"Age:"+age+"Address:"+address +";" +"Student Course:"+course;
}
}

package Entity;

/**
*
* @author Administrator
*/
public class Course {

private String coursedescription;

public String getCoursedescription() {
return coursedescription;
}

public void setCoursedescription(String coursedescription) {
this.coursedescription = coursedescription;
}

public Course(String coursedescription) {
this.coursedescription = coursedescription;
}

public Course() {
}


public String displayCourse(){
return"\nCourse:"+coursedescription;

}
}

package demo;

import java.util.*;


import java.util.ArrayList;
import Entity.Course;
import Entity.Student;

/**
*
* @author Administrator
*/
public class ArrayListTest {

public static void main(String[] args) {
Scanner scan = new Scanner(System.in);



ArrayList student = new ArrayList();

Course BSBA = new Course("Bachelor of Science in Business Administration");
Course BSIT = new Course("Bachelor of Science and Information Technology ");
Course BSBS = new Course("Bachelor of Secondary Education major in Biological Science ");
Course BSN = new Course("Bachelor of Science in Nursing ");
Student st1 = new Student("Malacaste, Annelyn B.", "2008-0079", 18, "Dawan", BSIT);
Student st2 = new Student("Magdagasang, Jonalyn B.", "2006-0179", 19, "Caraga", BSN);
Student st3 = new Student("Porio, Ciera Patrice P.", "2008-0139", 17, "Tamisan", BSBS);
Student st4 = new Student("Israel, Melanie S.", "2008-0009", 18, "Urban", BSIT);
Student st5 = new Student("Legspi, Mary Grace M.", "2008-0132", 19, "Pantukan", BSIT);

student.add(st1);
student.add(st2);
student.add(st3);
student.add(st4);
student.add(st5);

String result = "A";
int i;
while (result.equals("a") || result.equals("A")) {


System.out.println("STUDENT MENU");
System.out.println("");

System.out.println("Press 1 to Insert Student");
System.out.println("Press 2 to Delete Student");
System.out.println("Press 3 to Count no. of Student");
System.out.println("Press 4 to Clear the list of Student");
System.out.println("Press 5 to Display individual Student");
System.out.println("Press 6 to Display the list of Student");
System.out.println("");
System.out.println("Please pick your choice");
int choice = scan.nextInt();





switch (choice) {

case 1:
System.out.println("You Choose: Insert Student");

String name;
System.out.print("Enter Name: ");
name = scan.next();
System.out.print("Enter Age: ");
int age = scan.nextInt();
System.out.print("Enter Address: ");
String address = scan.next();
System.out.print("Enter ID No. ");
String ID = scan.next();
System.out.println("Course Description Menu: ");
System.out.println("BSIT: Batchelor of Science in Information Tsghnology");
System.out.println("BSN: Bachelor of Science in Nursing");
System.out.println("BSBA: Baghelor of Sgience in Business Adninictration ");
System.out.println("BSBS: Baghelor of Sgience in Biological Science");
System.out.print("Enter Course: ");
String C = scan.next();
Student s6;
if (C.equals("BSIT")) {
s6 = new Student(name, ID, age, address, BSIT);
} else if (C.equals("BSN")) {
s6 = new Student(name, ID, age, address, BSN);
} else if (C.equals("BSBA")) {
s6 = new Student(name, ID, age, address, BSBA);
} else {
s6 = new Student(name, ID, age, address, BSBA);
}
student.add(s6);
System.out.println();
for (int n = 0; n < student.size(); n++) {
System.out.println(student.get(n).displayStudesmenu() + "\n");
}
break;
case2:
System.out.println("You want to delete student? Ahm, ok!");
System.out.println("Enter index you want delete.");
try {
int a = scan.nextInt();
student.removeAll(student);
System.out.println("You've succesfully done it! Congrats!!");
}
catch (Exception exception) {
System.out.println("Nothing found!");

System.out.println();
}
break;

case3:
System.out.println("Count the student?!Wish is granted!");
System.out.println();
System.out.println("The student on the list are only" + Student.size());

break;

case4:
System.out.println("Clear the list?! Let's try.....");
student.clear();
System.out.println("Incredible! The list is cleared completely!!");

break;

case5:
System.out.println("Want to display individual students? Fine, whatever!");
System.out.println("Enter the index you want");
try {
int b = scan.nextInt();
System.out.println(student.get(i).displayStudesmenu());
} catch (Exception ex) {
System.out.println("Nothing found!");
}
break;


case6:
System.out.println("Display the list of student");
System.out.println();
for (int a = 0; a < student.size(); a++) {
System.out.println(student.get(a).displayStudesmenu() + "\n");

break;
}

default: {
System.out.println("Hey!You're out of the world are you? Look, your choice is out bound! Try again later.......");

}

System.out.println("By the way do you want to continue?Annie or exit");



result = scan.next();



}


}
}
}
####################################################################################
package demo;

/**
*
* LabExercise2
*/
import java.util.*;
public class Inverse{

public static void main(String[] args){

LinkedList firstlist = new LinkedList();
LinkedList secondlist = new LinkedList();

char me[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',};

for(int anne=0; anne<10; anne++ )
{
firstlist.add(me[anne]);
}

System.out.println("\n");
System.out.println("The elements of the firstlist are: ");

for(int l=0; l {
System.out.print("," + firstlist.get(l));
}

System.out.println("\n");
System.out.println("\nThe elements of the secondlist are: ");

for(int y=9; y>=secondlist.size(); y-- ){
if (me[y]==me[9]) {
System.out.print(" " + me[9]);
}

else{
System.out.print("," + me[y]);
}

}
System.out.println();
}
}
##########################################################################################
package demo;



/**
*
* LabExercise2
*/
import java.util.*;

public class Random {

public static void main(String[] args) {

LinkedList random = new LinkedList();

Random r= new Random();
int sum = 0;

for (int index = 0; index < 30; index++) {

int a = r.main(100);
random.add(r);
sum = sum + a;
}
for (int a = 0; a < random.size(); a++) {
System.out.println(random.get(a));
}
int average = sum / 25;

System.out.println("\n");
System.out.print("The sum is: " + sum);
System.out.println("\n");
System.out.print("The average is: " + average);

}
}

Thursday, January 21, 2010

IT123_PRELABEXERCISES

package entity;

public class Employee {

private int id;
private String name;
private int age;
private double salary;
private Department department;

public int getAge() {
return age;
}

public void setAge(int age) {
this.age = age;
}

public Department getDepartment() {
return department;
}

public void setDepartment(Department department) {
this.department = department;
}

public int getId() {
return id;
}

public void setId(int id) {
this.id = id;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public double getSalary() {
return salary;
}

public void setSalary(double salary) {
this.salary = salary;
}

public Employee(int id, String name, int age, double salary, Department department) {
this.id = id;
this.name = name;
this.age = age;
this.salary = salary;
this.department = department;
}

public Employee() {
}



public String displayEmployeeInfo() {
return "\nName:" + name + "\nAge:" + age + "\nID:" + id + "Department:" + department;


}
}

package entity;


public class Department {

private String description;
private int deptId;

public int getDeptId() {
return deptId;
}

public void setDeptId(int deptId) {
this.deptId = deptId;
}

public String getDescription() {
return description;
}

public void setDescription(String description) {
this.description = description;
}

public Department(int deptId,String description) {

this.deptId = deptId;
this.description = description;
}

public Department() {
}

public void displayInfo(){
System.out.println("Department Info." + description + "," + deptId + ",");

}

}



package demo;

import entity.*;
import java.util.Stack;

public class StackTest {

public static void main(String[] args){

Stackannie=new Stack();

annie.push(new Employee(100, "Jhon Smith", 23, 19304.54, new Department(11, "Marketing")));
annie.push(new Employee(101, "Eric Page", 25, 39304.54, new Department(12, "Resarch Development")));
annie.push(new Employee(102, "Caroline Santos", 28, 1904.54, new Department(13, "Human Resource")));

System.out.println("Stack size" +annie.size());
System.out.println("");
System.out.println();
System.out.println("Stack peek\n" +annie.peek().displayEmployeeInfo());
System.out.println("");
System.out.println("Performing pop operations..");
System.out.println("");

while (!annie.empty()){
Employee e = annie.pop();
System.out.println(e.displayEmployeeInfo());
System.out.println(".....................");
}

if (annie.empty()){
System.out.println("Stack is empty....");
}


}

}
\*THIS IS A RUNNABLE PROGRAM\
########################################################################################

package entity;


public class LinearSearch {

public static void main(String[] args) {

int[] a = {5, 10, 8, 6, 3, 10};
int searchKey = 6;
String x;
for (int i = 0; i <= a.length - 1; i++) {
if (searchKey == a[i]) {
x = "I found it!Yehey!!";


} else {
x = "Sorry I did not found it!";
}

System.out.println(x);
}
}
}


\*THIS A RUNNABLE PROGRAM\*
#########################################################################################


package entity;

public class LinerRunime {

public static void min(String[] args){

int a[]={4,5,6,8,10,1,3,5,7,9,5,6,7};



int searchKey=5;
String x="";
for(int i=0; i<=a.length-1; i++){
if(searchKey==a[1]){
x="EXIST";
break;
}
else{
x="NOT EXIST";
}
}
System.out.println(x);
}
}
\*THIS A RUNNABLE PROGRAM\*
##########################################################################################


package entity;

import java.util.Arrays;
import java.util.ArrayList;
import java.util.Collections;


public class PrintIntegerArraySort {

public static void main(String[] args) {

int[] integers = {10, 9, 0, 1, 11, 2, 5, 4};

ArrayList listInt = new ArrayList();



listInt.add(1);
listInt.add(10);
listInt.add(5);


System.out.println("COLLECTION SORT");
Collections.sort(listInt);
for (int a : listInt) {
System.out.println(a);
}
System.out.println("REVERSE COLLECTIONS");
Collections.reverse(listInt);
for (int j : listInt) {
System.out.println(j);

}

System.out.println("ARRAY SORT");
Arrays.sort(integers);

for (int i : integers) {

System.out.println(i);



}

}
}
\*THIS A RUNNABLE PROGRAM\*
##########################################################################################

package entity;

import java.util.*;
import java.util.ArrayList;


public class Untypedata {

public static Scanner console = new Scanner(System.in);

public static void main(String[] args) {



ArrayList unlist = new ArrayList();




int annie=5;

while (annie != 0) {

System.out.println("Enter double data");
double lhen = console.nextDouble();

annie--;


}

System.out.println("");

System.out.println("SORT DOUBLE TYPE");
for (double i : unlist) {

System.out.println(i);


}
}
}

\*THIS A RUNNABLE PROGRAM\*
##########################################################################################


package demo;

public class Constantruntime {

public static void min(String[] args){


int a[]={4,5,6,8,10,1,3,5,7,9,5,6,7};


int searchKey=5;
String x="";
for(int i=0; i<=a.length-1; i++){
if(searchKey==a[1]){
x="They are not equal!";
break;
}
else{
x="They are equal!";
}
}
System.out.println(x);
}
}
\*THIS A RUNNABLE PROGRAM\*
##########################################################################################