Sunday, February 8, 2009
Objects in the Direct Clothing Case Study
*Programme Name: Customer
*Subject: IT134 *Instructor: Mr. Dony Dongiapon
*Date stated: 02/08/09
*Date end: 02/08/09 */
public class Customer{
Int CustomerID;
String Name;
String Address;
int phoneNumber;
String EmailAddress;
public Customer(int CID, string N, String A, int PN D, string EMA)
{
this.CustomerID=CID;
this.Name=N;
this.Address=D;
this.phoneNumber=PN;
this.EmailAddress=EMA;
} Public shirt()
{ }
public int placeOrder()
{ }
public int cancelOrder()
{ }
public String displayInformation()
{
return String.format(CustomerID,Name,Address,phoneNumber,EmailAddress);
}
}
***************************************************************************************
/*Programmer: Norfe Gregorio
*Programme Name: Order
*Subject: IT134
*Instructor: Mr. Dony Dongiapon
*Date stated: 02/08/09
*Date end: 02/08/09 */
public class Order
{
Int OrderID;
double TotalPrice;
String status;
public Order(int OID, double TP, String S)
{
this.OrderID=OID;
this.TotalPrice=TP;
this.status=S;
}
public int addOrder()
{ }
public int removeStock()
{ }
public String displayInformation()
{
eturn String.format(OrderID,TotalPrice,status);
}
***************************************************************************************
/*Programmer: Norfe Gregorio
*Programme Name: shirt
*Subject: IT134
*Instructor: Mr. Dony Dongiapon
*Date stated: 02/08/09
*Date end: 02/08/09 */
public class Shirt
{
Int shirtID;
ouble price;
String color;
String description;
int quantityInStock;
public Shirt(int SID, double P, String C, String D, int QIS)
{
this.shirtID=SID;
this.price=P;
this.color=C;
this.description=D;
this.quantityInStock=QIS;
}
Public shirt()
{ }
public int addStock()
{
return quantityInStock=quantityInStock+stock;
}
public int removeStock()
{
return quantityInStock=quantityInStock-stock;
}
public String displayInformation()
{
return String.format(shirtID,price,color,description,quantityInStock);
}
}
***************************************************************************************
/*Programmer: Norfe Gregorio
*Programme Name: FormofPayment
*Subject: IT134
*Instructor: Mr. Dony Dongiapon
*Date stated: 02/08/09
*Date end: 02/08/09 */
public class FormofPayment{
private int checkno;
private int creditcardno;
private String expiredate;
public FormofPayment(int CN,int NCN,String ED)
{
this.checkno=CN;
his.cardno=NCN;
this.expiredate=ED; }
public String verifyCardno() {
}
public String verifyChekPayment() {
}
}
Wednesday, February 4, 2009
Cube
*Programme Name: Cube
*Subject: IT134
*Instructor: Mr. Dony Dongiapon
*Date stated: 02/04/09
*Date end: 02/04/09
*/
public class Cube{
private double width;
private double length;
private double height;
public Cube(double w, double h, double l)
{
this.width=w;
this.height=h;
this.length=l;
}
public Cube()
{
}
private double volume()
{
return width*length*height;
}
private double area()
{
return width*length;
}
public void setDimension(double nw, double nh, double nl)
{
this.width=nw;
this.height=nh;
this.length=nl;
}
public String displayCube()
{
return String.format(volume()+" and "+area());
}
}
CubeTester
/*Programmer: Norfe Gregorio
*Programme Name: CubeTester
*Subject: IT134
*Instructor: Mr. Dony Dongiapon
*Date stated: 02/04/09
*Date end: 02/04/09
*/
import java.util.Scanner;
public class CubeTester{
public static void main(String args[]){
Scanner scan=new Scanner(System.in);
Cube myCube1=new Cube(3,3,3);
Cube myCube2=new Cube();
System.out.println("The volume and area of a cube with width, height, and length is equal to 3: "+myCube1.displayCube());
System.out.println("Please fill in the following question.");
System.out.print("Enter width value: ");
double w=scan.nextDouble();
System.out.print("Enter height value: ");
double h=scan.nextDouble();
System.out.print("Enter length value: ");
double l=scan.nextDouble();
myCube2.setDimension(w,h,l);
System.out.println("The volume and area of a cube with width, height, and length is being entered by the user are : "+myCube2.displayCube());
}
}