Sunday, February 8, 2009

Case Study Solution

//ProgrammerName: Joan N. Dominguez
//ProgramName: Direct Clothing Case Study
//Purpose: To apply knowledge that i have learned in OOP.
//Date: February 8, 2009
//Subect: Computer Programming 3
//Instructor: Dony Dongiapon


import java.awt.*;
import javax.swing.*;
import java.text;
import java.awt.Graphics;


public class DirectClothing {
public static void main (String[]args){
public void Catalog(){
int array[];
String display = " ";
Shirt s = new Shirt(System.in);
int x;

void Printcatalog(){
System.out.println("Add a shirt: "); //method
x = s.nextString();
String blank = " ";
String x = name.length;
if(character.isYes (aChar)){
System.out.println("Do you want to remove it? + aChar + Yes. ");
x = s.previousString();
String x = name.length;
}else{
System.out.println("Do you want to remove it? + aChar + No. ");
x = s.previousString();
String x = name.length;
}
System.out.println("Do you want to remove it? + aChar + "is" +
cCharacter.isYes(aChar)? "Yes" : "No");

}
}

}

}

public void Shirt(){
protected int Shirt_ID;
protected int Price;
protected String color;
protected String Description;
protected int Quanity;

public Shirt(int a, double b, String c, String d, int e){
this.Shirt_ID = a;
this.Price = b;
this.color = c;
this.Description = d;
this.Quantity = e;
}
public void SetPrice(double b){
Price = b;
}
System.out.println("Shirt ID is " + a.length);
int blank = " ";
System.out.println("Price is " + b.length);
int blank = " ";
System.out.println("Color is " + c.length);
String blank = " ";
System.out.println("Description is " + d.length);
String blank = " ";
System.out.println("Quantity in Stock is "+ e.length);
int blank = " ";

}
}

__________________________________________________________________

//ProgrammerName: Joan N. Dominguez
//ProgramName: Order extends Shirt
//Purpose: To apply knowledge that i have learned in OOP.
//Date: February 8, 2009
//Subect: Computer Programming 3
//Instructor: Dony Dongiapon



public class Order extends Shirt {

protected int Order_ID;
protected double totalPrice;
protected int Status;

public Orders (int f, double g, int h){
this.Order_Id = f;
this.totalPrice = g;
this.Status = h;
}
public void setTotalPrice(double g){
totalPrice = g;
}
System.out.Println("Order ID is " + f.length);
int blank = " ";
System.out.Println("TotalPrice is " + g.length);
double blank = " ";
System.out.Println("Status is " + h.length);
int blank = " ";

}

}

_____________________________________________________________________

//ProgrammerName: Joan N. Dominguez
//ProgramName: Form of Payment extends Order
//Purpose: To apply knowledge that i have learned in OOP.
//Date: February 8, 2009
//Subect: Computer Programming 3
//Instructor: Dony Dongiapon



public class FormOfPayment extends Order {
protected int CheckNum;
protected int CreditCardNum;
protected String Expiration;

public Payment(int i, int j, String k){
this.CheckNum = i;
this.CreditCardNum= j;
this.Expiration = k;
}
System.out.println("Check Number is " + i.length);
int blank = " ";
System.out.println("Credit Card Number is " + j.length);
int blank = " ";
System.out.println("Expiration Date is " + k.length);
String blank = " ";
if(Credit CardNum == 0)
int credit cardNum = j;
j = int.parseInt(JOptionPane.ShowInputDialog("Verify Credit Card Number"));
}

}



_____________________________________________________________________

//ProgrammerName: Joan N. Dominguez
//ProgramName: Customer extends Order
//Purpose: To apply knowledge that i have learned in OOP.
//Date: February 8, 2009
//Subect: Computer Programming 3
//Instructor: Dony Dongiapon



public class Customer extends Order {
protected int Customer_ID;
protected String Name;
protected String Address;
protected int PhoneNum;
protected String Email;

public Customers(int l, String m, String n, int o, string p){
this.Customer_ID = l;
this.Name = m;
this.Address = n;
this.PhoneNum = o;
this.Email = p;
}

System.out.println("Customer ID is " + l.length);
int blank = " ";
System.out.Println("Name is " + m.length);
String blank = " ";
System.out.Println("Address is " + n.length);
String blank = " ";
System.out.Println("Phone Number is " + o.length);
int blank = " ";
System.out.Println("Email Address is " + p.length);
String blank = " ";
}
if (response == CANCEL){
}else{

}
}
}

________________________________________________________________________


//ProgrammerName: Joan N. Dominguez
//ProgramName: Direct Clothing Demo
//Purpose: To apply knowledge that i have learned in OOP.
//Date: February 8, 2009
//Subect: Computer Programming 3
//Instructor: Dony Dongiapon



public DirectClothingDemo() {
public static void main(String[]args){
DirectClothing Shirt = new DirectClothing();
DirectClothing Order = new DirectClothing();
DirectClothing FormOfPayment = new DirectClothing();
DirectClothing Customer = new DirectClothing();

Shirt.Shirt_ID("2009-01");
Shirt.Price();
Shirt.Color("Blue");
Shirt.Description(" ");
Shirt.Quanity("3");
Order.Order_ID("234-567");
Order.totalPrice("234-567");
Order.Status("234-567");
FormOfPayment.CheckNum("001-02");
FormOfPayment.CreditCardNum("1234-5678");
FormOfPayment.Expiration(" ");
Customer.Customer_ID("234");
Customer.Name("Joan Dominguez");
Customer.Address("Daticor Matiao, Mati City");
Customer.PhoneNum(" ");
Customer.Email(" ");
}
}

Wednesday, February 4, 2009

Cube Solution

//ProgrammerName: Joan N. Dominguez
//ProgramName: Cube
//Purpose: To create a program that calculate the volume of an object cube
//Date: February 04, 2009 
//Subect: Computer Programming 3
//Instructor: Dony Dongiapon



import javax.swing.JOptionPane;

public class Cube{
    private double Volume;
    private double Length;
    private double Width;
    private double Height;
    private double Area;

public CubeSolution(double Width, double Height, double Lenght)
  {
  this.Width;
  this.Height;
  this.Lenght;
  }
  public 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 void displayCube(){
  System.out.print(Volume() + " and " + Area());
}

}

}



//ProgrammerName: Joan N. Dominguez
//ProgramName: CubeTester
//Purpose: To create a cube tester that test the cube class
//Date: February 04, 2009 
//Subect: Computer Programming 3
//Instructor: Dony Dongiapon



import javax.swing.JOptionPane;

public class CubeTester{
    
    public static void main(String []args){
        Cube newCube1 = new Cube(10,10,10);
        Cube newCube2 = new Cube();
                    
JOptionPane.showMessageDialog("\t The volume and area of constructor having a parameter: " 
  + newCube1.displayCube(),"Volume and Area of a Cube",JOptionPane.INFORMATION_MESSAGE);

 String Width = JOptionPane.showInputDialog(" Enter a value of Width "));
 String Height = JOptionPane.showInputDialog(" Enter a value of Height "));
 String Length = JOptionPane.showInputDialog(" Enter a value of Length "));  
     
 double x = Integer.parseInt(Width);
 double y = Integer.parseInt(Height);
 double z = Integer.parseInt(Length);
    
     
Cube2.setDimension(x, y, z);
JOptionPane.showMessageDialog("\t The volume and area of constructor having no a parameter is: " 
 + newCube2.displayCube(),"Volume and Area of a Cube",JOptionPane.INFORMATION_MESSAGE);
 
          }
    }
}