Monday, February 9, 2009

Direct Clothing Case Study Solution


------------------------------------------------------------------------------


/*pragrammer name: Jay S. Gil
Title: Direct Clothing Case Study
Date Started: February 8, 2009
Date Finished : February 9, 2009
Purpose: To enhance my ability in programming and 
apply my knowledge that I learned in OOP.
Subject: Computer Programming 3
Instructor: Doni Dongiapon

*/


public class shirt 

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

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


//constructor

shirtID=newshirtID; 
price=newprice; 
color=newcolor; 
description=newdescription; 
quantity=newquantity; 



public int addStock( int stock) 

quantity=quantity+stock; 

return quantity; 



public int removeStock( int stock) 

quantity=quantity-stock; 
return quantity; 



public String displayInformation() 

return String.format("The ShirtID:%d\n ThePrice:%f\n ThE Color:%s\n
 The Description:%s\n The Quantity:%d" , 
shirtID,color,price,description,quantity); 


public void addstock(int newshirtid, double newprice, 
String newcolor, String newdescription, int newquantityinstock)
{
shirtId=newshirtId;
price=newprice;
color=newcolor;
description=newdescription;
quantityinstock=newquantityinstock;

System.out.println("ShirtID: %d\n Price: %f\n Color: %s\n Description: 
%s\n Quantity in Stock: %d",shirtID,color,price,description,quantity); 


System.out.println("The information above has been succesfully added");
}

public void removestock(int newshirtid)
{
shirtid=newshirtid;
System.out.println("The shirt#: \n"+shirtId);
System.out.println("succesfully... removed");
}
}


------------------------------------------------------------------------------

/*pragrammer name: Jay S. Gil
Title: Direct Clothing Case Study
Date Started: February 8, 2009
Date Finished : February 9, 2009
Purpose: To enhance my ability in programming and 
apply my knowledge that I learned in OOP.
Subject: Computer Programming 3
Instructor: Doni Dongiapon

*/


public class order
{

 private String orderID;
 private double totalprice; 
private String status;

public Order()
{

}
public void orderShirt(String neworderID,double newtotalorderprice,String newstatus)



String orderID=neworderID; 
double totalorderprice=newtotalorderprice;
 String status=newstatus;
}

public void setOrderID(String neworderID)

{ String orderID=neworderID;

}
public String getOrderID()

{
 return orderID;

}
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;

}
}

-----------------------------------------------


/*pragrammer name: Jay S. Gil
Title: Direct Clothing Case Study
Date Started: February 8, 2009
Date Finished : February 9, 2009
Purpose: To enhance my ability in programming and 
apply my knowledge that I learned in OOP.
Subject: Computer Programming 3
Instructor: Doni Dongiapon

*/



public class customer
{



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




public Customer()
{
}

public Customer(int ID, String cname, String caddress,
 int cphonenumber, String cemailaddress)

{
customerid=ID;
name=cname;
address=caddres;
phonenumber=cphonenumber;
emailaddress=cemailaddress;

}


public void customerprofile(String newname, int newid, 
String newaddress, int newphonenumber, String newemailaddress)
{
customerid=newid;
name=newname;
address=newaddress;
phonenumber=newphonenumber;
emailaddress=newemailaddress;
System.out.println("Cutomer's Background");
System.out.println("Customer Name: %s\n Customer ID: %d\n Customer Address: %s\n
 Customer PhoneNumber: %d\n Customer E-mail address: %s", customerid,
name, address, phonenumber, emailaddress);
}
}

----------------------------------------------------------------------


/*pragrammer name: Jay S. Gil
Title: Direct Clothing Case Study
Date Started: February 8, 2009
Date Finished : February 9, 2009
Purpose: To enhance my ability in programming and 
apply my knowledge that I learned in OOP.
Subject: Computer Programming 3
Instructor: Doni Dongiapon

*/



public class Catalog {



public Catalog()
{
}

public Catalog(int cshirtid, double cprice, String ccolor, 
String cdescription, int cquantityinstock)
{
shirtid=cshirtid;
price=cprice;
color=ccolor;
description=cdescription;
quantityinstock=cquantityinstock;
}



public void addashirt(int newshirtid, double newprice, String newcolor, String newdescription, int newquantityinstock)
{
shirtid=newshirtid;
price=newprice;
color=newcolor;
description=newdescription;
quantityinstock=newquantityinstock;

System.out.println("ShirtID: %d\n Price: %f\n Color: %s\n Description: %s\n 
Quantity in Stock: %d",shirtid,price,color, description, quantityinstock);
System.out.println("The data was added...");
}


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");
}
public void removeashirt(int newshirtid)
{
shirtid=newshirtid;
System.out.println("The ShirtID: %d",+shirtid);
System.out.println("The data was successfully removed from the order");
}
}

--------------------------------------------------------------------------------


/*pragrammer name: Jay S. Gil
Title: Direct Clothing Case Study
Date Started: February 8, 2009
Date Finished : February 9, 2009
Purpose: To enhance my ability in programming and 
apply my knowledge that I learned in OOP.
Subject: Computer Programming 3
Instructor: Doni Dongiapon

*/


public class formOfpayment


private String checknumber; 
private String cardnumber; 
private String expirationdate;

public FormofPayment(String newcheck,String newcard,String newexpirationdate)



checknumber=newcheck; 
cardnumber=newcard; 
expirationdate=newexpirationdate 
}



 public String getChecknumber()

{
 return checknumber;

}

public void setCardnumber(String newcard)

{ cardnumber=newcard;



public String getCardnumber()

{

 return cardnumber;
}

public void setExpirationdate(String newexpirationdate)



expirationDate=newepirationdate;



public String getExpirationdate()


returnexpirationDate;

}public void Dispalymessage()



System.out.println("\nWelcome!!!!\n");
System.out.println("This is your cardnumber:%s/n and your checknumber is: %s");

}
}

------------------------------------------------------------------------------


import java.util.Scanner;

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

 { 

String name;
int customerid;
String address;
int phonenumber;
String emailaddress;
int shirtid;
double price;
String color;
String description;
int quantity;
int payment;
int ordernumber;


System.out.println("Be one of us...Welcome to Direct Clothing Solution\n");

System.out.println("24 Hours available...\");
Scanner input= new Scanner(System.in); 

Shirt myShirt=new Shirt(); 

System.out.println("Welcome to Direct Clothing:\n\nHere's the Catalog?");

 myShirt.displayCatalog(); 

Scanner input= new Scanner(System.in); 
System.out.println("Want to add a stock?"); 

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("Your Shirt was Successfully added.....\n 
System.out.println("Thank You and God Bless"); 

}
 else
 { 

System.out.println("IT is OK"); 


}
 }




Wednesday, February 4, 2009

Cube Manipulation

/*Programmer Name: Jay S. Gil

Program Title: Cube ManipulationDate:

February 2009

Purpose: To classes using Modifiers

*/

import java.util.Scanner;

public class Cube{   

private double width;   

private double length;   

private double height;   

private double volume;   

private double area;           

public Cube(double w, double h, double l)    {   

    width=w;        height=h;        length=l;   

}    public Cube()   

{           

}    private double volume() 

  {        return (width*length*height);       

        }   

private double area() 

  {                return (width*length);       

        }        public void setDimension(double newwidth, double newheight, double newlength) 

  {        width=newwidth;     

  height=newheight;       

length=newlength;    } 

  public String displayCube()   

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

  }

}    

---------------------------------------------------------------------------------------

/*Programmer Name: Jay S. Gil
Program Title: Cube Manipulation
Date: February 2009
Purpose: To create a tester that test the cube class

*/


import java.util.Scanner;

class CubeTester{

public static void main(String args[]){

double l;
double w;
double h;

System.out.println("Constructor with a parameter");

Cube newCube=new Cube(1,2,3);;

newCube.displayCube();

System.out.println("Cube object  constructor without parameter"); 

Scanner a=new Scanner(System.in);

System.out.println("Enter value of  length:");

l=a.nextDouble();

Scanner b=new Scanner(System.in);

System.out.println("Enter value of  height:");
w=b.nextDouble();Scanner 
c=new Scanner(System.in);

System.out.println("Enter value of  width:");

h=c.nextDouble();
System.out.println("The Cube object without a parameter"); 



Cube secondCube=new Cube(); 
secondCube.setDimension(l,w,h);
secondCube.displayCube();


}
}


Tuesday, February 3, 2009

"Here we go again.,,.let's get it on.,,"