Archive for the ‘Programming’ Category

my upload for the picture was totally work now!

Wednesday, January 6th, 2010

665926689_m

for almost 6 month i cant upload my picture using the upload gen from the wordpress and now i already solve the problem using my own brain yang terror ! yeay.

haha

how to do it:

for some forum, they told to change the permission for the folder to 775, 777 or bla33. but all of them didnt work!

and i use my ability to determine on my own and i found it, i change my folder “to ” to => [photoupload] and it works ! wohoo.

fakhrul yag comel

Share/Save/Bookmark

Assignment 2, JAVA PROGRAMMING - Inheritance concept

Tuesday, August 18th, 2009

Item

package package4;

public class Item
{
protected String code;
protected double price;

public Item()
{
code=” “;
price=0;
}
public Item(String cd, double pr)
{
code=cd;
price=pr;
}
public void setItem(String cd, double pr)
{
code=cd;
price=pr;
}

public String getCode(){return code;}
public double getPrice(){return price;}

public String toString()
{
return “Code: “+code +”\nPrice: RM “+price+”\n”;
}
}

(more…)

Share/Save/Bookmark

Appendix A- Composition

Monday, August 17th, 2009

Date.Java

public class Date
{
private int day;
private int month;
private int year;

public Date()
{
day=0;
month=0;
year=0;
}
public Date(int day, int month, int year)
{
this.day=day;
this.month=month;
this.year=year;
}
public void setDate(int d, int m, int y)
{
day=d;
month=m;
year=y;
}
public int getDay(){return day;    }
public int getMonth(){return month;}
public int getYear(){return year;}

public String toString()
{

return  day +”/”+ month +”/”+ year;
}
}

Employee

public class Employee
{
private String name;
private long id;
private Date birthdate;

public Employee()
{
name=”";
id=0;
birthdate= new Date(0,0,0);
}

public Employee(String n, long i, Date bd)
{
name=n;
id=i;
birthdate=bd;
}
public void setEmployee(String n, long i, Date bd)
{
name=n;
id=i;
birthdate=bd;
}
public String getName(){return name;}

public long getId(){return id;}

public Date getBirthdate(){return birthdate;}
public String toString()
{
return “\n Name:”+ name+”\n Id:”+id+”\n Birthdate: “+birthdate.toString()+”\n”;
}
}

EmployeeApp

import java.util.*;

public class EmployeeApp
{
public static void main (String args[])
{
Scanner console=new Scanner(System.in);
console.useDelimiter(System.getProperty(”line.separator”));

Employee arrayE[]= new Employee[3];

String ename;
long eid;
int dd,mm,yy;
Date birth;

System.out.println(”Enter Data for 3 Employee: \n”);
for(int m=0; m< 3; m++)
{
System.out.println(” \n Enter Name: “);
ename= console.next();

System.out.println(”\n Enter id:  “);
eid=console.nextLong();

System.out.println(”\n \n Enter Birthday: “);

System.out.println(”\n Enter Day:”);
dd= console.nextInt();

System.out.println(”\n Enter Month: “);
mm=console.nextInt();

System.out.println(”\n Enter Year: “);
yy=console.nextInt();

birth= new Date(dd,mm,yy);
arrayE[m]= new Employee(ename, eid, birth);
}

System.out.println(”\n The Employee Records:  “);
for(int m=0; m<3 ; m++)
{
System.out.println(arrayE[m].toString());

}

System.out.println(”List all Employee born in 1990: “);

for(int x=0; x<3 ; x++)
{
if(arrayE[x].getBirthdate().getYear()==1990)
System.out.println(arrayE[x].toString());

}

}
}

From Page : 95*,

Uitm Perlis,

CSC218,

Norfaidah Che Ee, Nor Azlina Aziz Fadzillah

*with update coding in above programming.

Share/Save/Bookmark

Answer for 1.1: Student.Java

Sunday, August 16th, 2009

package package2;

public class Student
{
protected String StudentId;
protected String StudentName;
protected int StudentAge;

public Student()
{
StudentId=” “;
StudentName=” “;
StudentAge=0;

}

public Student(String Si, String Sn, int Sa)
{
StudentId=Si;
StudentName=Sn;
StudentAge=Sa;
}
public void SetStudent(String Si, String Sn, int Sa)
{
StudentId=Si;
StudentName=Sn;
StudentAge=Sa;
}
public String getStudentID()
{
return StudentId;
}
public String getStudentName()

{
return StudentName;
}

public int getStudentAge()
{
return StudentAge;
}

public String toString()
{
return “Student Name = “+StudentName+”n”+
“Student Id   = “+StudentId+”n”+
“Student Age  = “+StudentAge+”n”;
}
}

Share/Save/Bookmark

Answer for 1.1: Senior.java

Saturday, August 15th, 2009

package package2;

public class Senior extends Student
{
private boolean music;
private boolean dance;
private boolean paint;

public Senior()
{
super();
boolean  music = true;
boolean dance= true;
boolean  paint= true;
}
public Senior(String si, String sn, int sa, boolean  mu, boolean  da, boolean  pa)
{
super(si, sn, sa);
music=mu;
dance=da;
paint=pa;
}
public void setSenior(boolean  mu, boolean da, boolean  pa)
{
music=mu;
dance=da;
paint=pa;
}

public boolean getMusic()
{
return music;
}
public boolean  getDance()
{
return dance;
}
public boolean  getPaint()
{
return paint;
}

public double CalSeniorFee()
{
double fee=0;

if(music==true && dance==true && paint==true)
fee=70+100+80;
else
if(music==true && dance==true && paint==false)
fee=70+100;
else
if(music==true && dance==false && paint==true)
fee=70+80;
else
if(music==false && dance==true && paint==true)
fee=100+80;
else
if(music==false && dance==false && paint==true)
fee=80;
else
if(music==false && dance==true && paint==false)
fee=100;
else
if(music==true && dance==false && paint==false)
fee=70;

return fee;
}
public String toString()
{
return super.toString()+”Music: “+music+”\nDance: “+dance+”\nPaint: “+paint+”\n”;
}
}

Share/Save/Bookmark

Answer for 1.1: Junior.Java

Friday, August 14th, 2009

package package2;

public class Junior extends Student
{
private boolean music;
private boolean sing;

public Junior()
{
super();
boolean music= true;
boolean sing=true ;
}
(more…)

Share/Save/Bookmark

Answer for 1.1: StudentApp.java

Thursday, August 13th, 2009

import package2.*;
import java.util.*;
import java.io.*;
import java.text.DecimalFormat;

public class StudentApp
{
public static void main(String args[])
{
Scanner console = new Scanner(System.in);
String lineSeparator = System.getProperty(”line.separator”);
console.useDelimiter(lineSeparator);

int ss=0, jj=0;
String name, id;
int status,fee,age;
boolean junior_music, junior_singing;
boolean senior_music, senior_dancing, senior_painting;
int totalfee=0;
(more…)

Share/Save/Bookmark


Blog Widget by LinkWithin