Sunday, February 8, 2009

SET OF CLASSES

/* Programmer : Dandy A. Macaubos

  Program name : Direct Clothing Case Study
  Date Started : February 7,2009
  Date Finished : February 8,2009
  Purpose : To give solution to direct clothing case study
  Instructor : Dony Dongiapon
  Subject : IT134
*/

import java.util.Scanner;

public class ClothingTester{ 
 
 public static void main(String args[]){ 
 
 Scanner input= new Scanner(System.in); 
 Shirt myShirt=new Shirt();
 System.out.println("Welcome:\n\n Direct Clothing!!\nPlease Choose on our Catalog?");
 myShirt.displayCatalog(); 
 Scanner input= new Scanner(System.in); 
 System.out.println("Do you have your choice ?"); 
 if (input=='y') 
 { 
 System.out.println("Enter ShirtID:"); 
 String ID=input.nextLine();
 myShirt.setShirtID(ID); 
 
 System.out.println(); 
 System.out.println("Enter Price:"); 
 double cprice=input.nextDouble(); 
 myShirt.setPrice(cprice); 
 
 System.out.println();
 System.out.println("Enter Color:"); 
 String ccolor=input.nextLine(); 
 myShirt.setColor(ccolor);  
 ]
 System.out.println(); 
 System.out.println("Enter Quantity:"); 
 int cquantity=input.nextInt(); 
 myShirt.setQuantity(cquantity); 
 
 System.out.println(); 
 System.out.println("Enter shirt Description:"); 
 String cdescription=input.nextLine(); 
 myShirt.setDescription(cdescription); 
 
 System.out.println(); 
 System.out.println("Shirt was chosen successfully.\n\n\t Thank You!!!");
  } 
 else 
 { 
 System.out.println("Ok"); 
 } 
  } 
}

________________________________________________________________

public class Customer{

 //variable

 private int customerid;
 private String name;
 private String address;
 private int phonenumber;
 private String emailaddress;


 //constructor 

 public Customer(){
 }

 //method 

 public void customergreetings(String newname)
 {
 name=newname; 

 }

 public void customerprofile(String newname, int newid, String newaddress,int newphonenumber, String newemailaddress)
 {
 
 name=newname;
 address=newaddress;
 customerid=newid;
 phonenumber=newphonenumber;
 emailaddress=newemailaddress;
 
 System.out.println("P_R_O_F_I_L_E");
 System.out.println("Name: "+name+ "\nCustomer ID: "+customerid+"\nAddress:"+address+"\nPhone Number: "+phonenumber+"\nE-mail address: "+emailaddress);
 }
}

____________________________________________________________________________________

public class Shirt {
 
 //variable

 private String shirtID;
  private double price;
  private String color; 
 private int quantity;
  private String description;

 public Shirt(){ 
 }
 public Shirt(String newshirtID,double newprice,String newcolor, int newquantity,String newdescription){ 

 //constructor

 shirtID= newshirtID; 
 price=newprice; 
 color= newcolor; 
 quantity=newquantity; 
 description=newdescription;
 }
 //method 
 
 public void setShirtID(String newshirtID){ 
 
 shirtID= newshirtID;
 }
 public String getShirtID()
 { 
 return shirtID;
 } 
 public void setPrice(double newprice)
 { 
 price=newprice;
 }
 public double getPrice()
 { 
 return price;
 }
 public void setColor(String newcolor)
 {
  color= newcolor;
 }
 public String getColor()
 {
  return color;
 }
 public void setQuantity(int newquantity)
 {
  quantity=newquantity;
 }
 
 public int getQuantity()
 { 
 return quantity;
 }

 public void setDescription(String newdescription)
 { 
 description=newdescription;
 }
 public String getDescription()
 { 
 return description;
 }
 
 public String removestock()
 { 
 System.out.println("The Shirt with an ID\t\s getShirtID()); 
 System.out.println("was successfully remove.Thank you!!!");
 }
}
__________________________________________________________________________________________

public class Order{ 
 
 // variable
 
 private String orderID; 
 private double totalprice; 
 private String status;
 
 public Order(){
 }
 public void orderShirt(String neworderID,double newtotalorderprice,String newstatus)
 { 
 
 //constructor
 
 String orderID=neworderID;
 double totalorderprice=newtotalorderprice; 
 String status=newstatus;
 }
 public void setOrderID(String neworderID)
 {
 String orderID=neworderID;
 }
 public String getOrderID()
 { 
 return orderID;
 }
 //method

 public void setTotaltorderprice(double newtotalorderprice)
 { 
 double totalorderprice=newtotalorderprice;
 }
 
 public double getTotaltorderprice()
 { 
 return totalorderprice;
 }

 public void setStatus(String newstatus)
 { 
 String status=newstatus;
 }
 public String getStatus()
 { 
 return status;
 }
}

_____________________________________________________________

public class FormofPayment{ 
 
 //variable

 private String checknumber; 
 private String cardnumber; 
 private String expirationDate;
 
 public FormofPayment(String check,String card,String date)

 //constructor{
 
 checknumber=check; 
 cardnumber=card; 
 expirationDate=date; 
 }
 //method
 public void setChecknumber(String check){
 
 checknumber=check;
 } 

 public String getChecknumber(){
 
 return checknumber;
 }
 
 public void setCardnumber(String card){ 

 cardnumber=card;
 } 
 
 public String getCardnumber(){ 

 return cardnumber;
 }
 
 public void setExpirationdate(String date){ 
 expirationDate=date;
 } 

 public String getExpirationdate(){ 
 returnexpirationDate;
 }
 public void Dispalymessage()
 { 
 System.out.println("Your checknumber is:%s/nand checknumber is:%s");
 }
}
__________________________________________________________


 
 public class Catalog {
 public void displayCatalog(){ 
 System.out.println("ShirtID:252-22\nPrice:25,000\nColor:Black \nQuantity:5\nDescription:Beautiful"); 
 System.out.println("ShirtID:252-54\nPrice:90,000\nColor:Pink\nQuantity:1\nDescription:Nice");
 }
}

____________________________________________________________

Wednesday, February 4, 2009

CUBE

/* Programmer : Dandy A. Macaubos
     Program name : Cube
     Date Started : February 4,2009
    Date Finished : February 4,2009
    Purpose : To have a program using encapsulation
    Instructor : Dony Dongiapon
    Subject : IT134
*/

import javax.swing.JOptionPane;
 
  public class Cube{

 private double width;
 private double height;
 private double lenght;
 
  public Cube(double wid, double heigh, double len)
 {
 this.width=wid;
 this.height=heigh;
 this.lenght=len;
 }
  private Cube()
 {
 
 }
 
  public void SetDimension(double newwidth, double newheight, double newlength)
 {
 this.width=newwidth;
 this.height=newheight;
 this.lenght=newlength;
 }
 
 
  private double volume(){
 return width*lenght*height;
  }

  private double area(){
 return width*lenght;
  }
 

  public String displayCube(){
 return String.format(volume()+" and "+area());
  }

}
 
 
/* Programmer : Dandy A. Macaubos
     Program name : Cube
     Date Started : February 4,2009
     Date Finished : February 4,2009
     Purpose : To have a program that uses  encapsulation
     Instructor : Dony Dongiapon
     Subject : IT134
*/

import javax.swing.JOptionPane;

public class CubeTester{
 
  public static void main(String []args){

 double width;
 double height;
 double length;

 width=Integer.parseInt(JOptionPane.showInputDialog("Enter width value"));
 height=Integer.parseInt(JOptionPane.showInputDialog("Enter the value of the height"));
 length=Integer.parseInt(JOptionPane.showInputDialog("Enter the value of the length"));

 
 
 }
}