You are on page 1of 12

Project

in
CS ELECTIVE
Submmited by:
Arlo Carl Ancheta Figuracion
BS Computer Science II-A

December 14, 2012

Project Name: MyFirstProgram


Source Code:
public class HelloWorld {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("Hello World");
System.out.print("Hello Data");
}
}

Definition:
The code above is a source code a java programming that will display the characters
Hello World and also the Hello Data and this is my first program in java.

Project Name: IfElse


Source Code:
import java.util.*;
public class Gender {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String gender;
Scanner sex=new Scanner(System.in);
System.out.print("Enter Gender: ");
gender=sex.next();

if(gender.equals("m")){
System.out.println("Male");
}
else if(gender.equals("f")){
System.out.println("Female");
}
else{
System.out.println("Invalid Character");
}
}

Definition:
The code above is a source code of an if else condition in java programming that will
ask the user what is the Gender and display the gender of the user. The legends are m that
corresponds to Male and f for the Female.

Project Name: Exer1


Source Code:
public class Bio{
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub

System.out.println("PERSONAL INFORMATION");
System.out.print("Name: Arlo Carl Ancheta Figuracion");
System.out.println("
Age: 19 years old ");
System.out.print("Birthday: April 14, 1993");
System.out.println("
Birth Place: Laoag City ");
System.out.println("Address: Brgy. 57 Daurao, Pila Laoag City");
System.out.print("Civil Status: Single");
System.out.println("
Citizenship: Filipino");
System.out.println("");
System.out.println("FAMILY BACKGROUND");
System.out.println("Name of Father: Warlito Amistosa
Figuracion");
System.out.println("Name of Mother: Anna Liza Ancheta
Figuracion");
System.out.println("Siblings: Ariel Anne Wharly A. Figuracion");
System.out.println("
Angelie July Anne A. Figuracion");
}

System.out.println("Motto: Time is Gold");

Definition:
The source code above is a program that will display only my Biodata. By using the
[System.out.println("");].

Project Name: Quiz1


Source Code:
import java.util.*;
public class Quiz1 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int x;
int y;
Scanner num = new Scanner(System.in);
System.out.print("Enter First Number: ");
x=num.nextInt();
System.out.print("Enter Second Number: ");
y=num.nextInt();
System.out.println("Sum: "+(x+y));
System.out.println("Difference: "+(x-y));
System.out.println("Product: "+(x*y));
System.out.println("Quotient: "+(x/y));
}
}

Definition:
The source code above is a program that will compute and display for the sum,
difference, product and quotient of the two numbers/integers by the user.

Project Name: Salary


Source Code:
import java.util.*;
public class Salary {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sal = new Scanner(System.in);
String empname;
int noOfWork;
int noOfDays;
double pagibig,sss,Tax,Tax1;
double TofDeduction;
double BSalary,Tsalary;
System.out.print("Name: ");
empname=sal.next();
System.out.print("No. of hours Worked per Day: ");
noOfWork=sal.nextInt();
System.out.print("No. of Days Worked: ");
noOfDays=sal.nextInt();
pagibig=100.00;
sss=150.00;
Tax1=0.12;
BSalary=(noOfWork*85)*noOfDays;
Tax=BSalary*Tax1;
TofDeduction=pagibig+sss+Tax1;
Tsalary=BSalary-TofDeduction;
System.out.println("Name: "+empname);
System.out.println("No. of hours Worked per Day: "+noOfWork);
System.out.println("No. of Days Worked: "+noOfDays);
System.out.println("All the Deductions ");
System.out.println("
-Pag-ibig: "+pagibig);
System.out.println("
-SSS: "+sss);
System.out.println("
-Tax: "+Tax1);

System.out.println("Basic Salary: "+BSalary);


System.out.println("Totality of Deduction: "+TofDeduction);
System.out.println("Total Salary: "+Tsalary);

Definition:
The source code above will compute for the Basic Salary by multiplying the product of
number of hours work in a day and 85 and the number of days worked in a month, Totality of
Deduction by adding the pag-ibig(100.00), SSS(150.00) and the Tax of Basic Salary of 12%and
the Total/Net Salary by subtracting the Basic Salary and the Totality of deduction and display

and also ask for the name of the employee, number of days worked in a month, number of hours
work in a day, Pag-ibig, SSS and Tax.
Project Name: IfelseSalary
Source Code:
import java.util.*;
public class IfelseSalary {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sal = new Scanner(System.in);
String status;
String empname;
int noOfWork;
int noOfDays;
double pagibig,sss,Tax,Tax1;
double TofDeduction;
double BSalary,Tsalary;
System.out.print("Name: ");
empname=sal.next();
System.out.print("No. of hours Worked per Day: ");
noOfWork=sal.nextInt();
System.out.print("No. of Days Worked: ");
noOfDays=sal.nextInt();
System.out.print("Enter Status: ");
status=sal.next();
if(status.equals("s")){
pagibig=100.00;
sss=150.00;
Tax1=0.12;
BSalary=(noOfWork*85)*noOfDays;
Tax=BSalary*Tax1;
TofDeduction=pagibig+sss+Tax;
Tsalary=BSalary-TofDeduction;
System.out.println("Name: "+empname);
System.out.println("No. of hours Worked per Day:
"+noOfWork);

System.out.println("No. of Days Worked: "+noOfDays);


System.out.println("Single");
System.out.println("All the Deductions ");
System.out.println("
-Pag-ibig: "+pagibig);
System.out.println("
-SSS: "+sss);
System.out.println("
-Tax: "+Tax1);
System.out.println("Totality of the Deduction:

"+TofDeduction);

System.out.println("Basic Salary: "+BSalary);


System.out.println("Total Salary: "+Tsalary);

}
else if(status.equals("m")){
pagibig=100.00;
sss=150.00;
Tax1=0.06;
BSalary=(noOfWork*85)*noOfDays;
Tax=BSalary*Tax1;
TofDeduction=pagibig+sss+Tax;
Tsalary=BSalary-TofDeduction;
System.out.println("Name: "+empname);
System.out.println("No. of hours Worked per Day:

"+noOfWork);

System.out.println("No. of Days Worked: "+noOfDays);


System.out.println("Married");
System.out.println("All the Deductions ");
System.out.println("
-Pag-ibig: "+pagibig);
System.out.println("
-SSS: "+sss);
System.out.println("
-Tax: "+Tax1);
"+TofDeduction);

System.out.println("Totality of the Deduction:


System.out.println("Basic Salary: "+BSalary);
System.out.println("Total Salary: "+Tsalary);

}
else if(status.equals("w")){
pagibig=100.00;
sss=150.00;
Tax1=0.03;
BSalary=(noOfWork*85)*noOfDays;
Tax=BSalary*Tax1;
TofDeduction=pagibig+sss+Tax;
Tsalary=BSalary-TofDeduction;
System.out.println("Name: "+empname);
System.out.println("No. of hours Worked per Day:

"+noOfWork);

System.out.println("No. of Days Worked: "+noOfDays);


System.out.println("Widowed");
System.out.println("All the Deductions ");
System.out.println("
-Pag-ibig: "+pagibig);
System.out.println("
-SSS: "+sss);
System.out.println("
-Tax: "+Tax1);
"+TofDeduction);

System.out.println("Totality of the Deduction:


System.out.println("Basic Salary: "+BSalary);
System.out.println("Total Salary: "+Tsalary);

}
else{
}
}

Definition:

System.out.println("invalid");

The source code above will compute for the Basic Salary by multiplying the product of
number of hours work in a day and 85 and the number of days worked in a month, Totality of
Deduction by adding the pag-ibig(100.00), SSS(150.00) and the Tax of Basic Salary and the
Total/Net Salary by subtracting the Basic Salary and the Totality of deduction and display and
also ask for the name of the employee, number of days worked in a month, number of hours
work in a day, Pag-ibig, SSS and Tax.
This program will ask the if the employee is s single, m married or w widowed to
know what the corresponding Tax value is for the employee.
Project Name: OddEven
Source Code:
import java.util.*;
public class OddEven{
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int n;
Scanner num = new Scanner(System.in);
System.out.print("Enter Integer: ");
n=num.nextInt();
if (n % 2 == 0)
System.out.println("Given number is Even.");
else
System.out.println("Given number is Odd.");
}
}

Definition:
The source code above is determining if the number/integer input by the user is Odd or
Even.

Project Name: BioInput


Source Code:
import java.util.*;
public class BioInput {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String lname,fname,sname,mname;
int age,day,year;
double num;
String email,Sex;
String mons,bplace,add;
String cstatus,cship,rel;
String Fname,Mname,Sibling,Sibling1;
Scanner bio=new Scanner(System.in);
System.out.println("PERSONAL INFORMATION");
System.out.print("Last Name:");
lname=bio.next();
System.out.print("First Name:");
fname=bio.next();
System.out.print("Second Name:");
sname=bio.next();
System.out.print("Middle Name:");
mname=bio.next();
System.out.println("Age: ");
age=bio.nextInt();
System.out.println("Sex: ");
Sex=bio.next();
System.out.println("Contact Number: ");
num=bio.nextInt();
System.out.println("E-mail: ");
email=bio.next();
System.out.print("Birthday: ");
day=bio.nextInt();
System.out.print("Birthmonth: ");
mons=bio.next();
System.out.print("Birthyear: ");
year=bio.nextInt();
System.out.println("Birth Place: ");
bplace=bio.next();
System.out.println("Address: ");
add=bio.next();
System.out.print("Civil Status: ");
cstatus=bio.next();
System.out.println("Citizenship: ");
cship=bio.next();
System.out.println("Religion: ");
rel=bio.next();
System.out.println("");

System.out.println("FAMILY BACKGROUND");
System.out.println("Name of Father:
Fname=bio.next();
System.out.println("Name of Mother:
Mname=bio.next();
System.out.println("Siblings: ");
Sibling=bio.next();
Sibling1=bio.next();

");
");

System.out.println("PERSONAL INFORMATION");
System.out.print("Name: "+fname+" "+sname+" "+mname+" "+lname);
System.out.println("
Age: "+age+" tears old");
System.out.print("Sex: "+Sex);
System.out.println("
Contact Number: "+num);
System.out.println("E-mail: " + email);
System.out.print("Birthday: "+day+" "+mons+" "+year);
System.out.println("
BirthPlace: "+bplace);
System.out.println("Address: "+add);
System.out.print("Civil Status: "+cstatus);
System.out.println("
Citizenship: "+cship);
System.out.println("Religion: "+rel);
System.out.println("FAMILY BACKGROUND");
System.out.println("Name of Father: "+Fname);
System.out.println("Name of Mother: "+Mname);
System.out.print("Siblings: "+Sibling);
System.out.println(
Sibling1);
System.out.println("Motto: Time is Gold");
}
}

Definition:
The source code above is a program that will ask the user what is the following last name,
first name, second name, middle name, address, age, birthday, birthplace, citizenship, religion,
civil status, name of Father and mother and siblings, sex preference, contact number and motto.
And display them. By using the [System.out.println("" + );].

Project Name: PesoDenomination


Source Code:
import java.util.*;
public class Peso {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int amount,a,b,c,d,e,f;
int aa,bb,cc,dd,ee,ff;
Scanner num= new Scanner(System.in);
System.out.print("Enter a Number: ");
amount= num.nextInt();
a = amount/100;
aa = amount % 100;
System.out.println("100 peso bill: " + a);
b = aa / 50;
bb = aa % 50;
System.out.println("50 peso bill: " + b);
c = bb / 20;
cc = bb %20;
System.out.println("20 peso bill: " + c);
d = cc / 10;
dd = cc % 10;
System.out.println("10 peso bill:"+ d);
e = dd / 5;
ee = dd % 5;
System.out.println("5 peso bill: "+ e);
f = ee / 1;
ff = ee % 1;
System.out.println("1 peso bill: "+ f);
}

Definition:
The Source code above is programs that will denominate a certain amount of bill or
currency.

You might also like