Thursday, July 17, 2014

Sales Simulator Java

Class 1 : 
Customer 

package Orders_package;

public class Customer
{


}


Class 2: 
CustomerSales 
package Orders_package;

public class CustomerSales
{
public static int numberOfOrders = 0;
public static double ordersTotal = 0.0;
private int orderNumber;
private String company;
private static double totalOrder;

public CustomerSales()
{
orderNumber = 0;
company = " ";
totalOrder = 0.0;
numberOfOrders++;
}
public CustomerSales(int x, String y, double z)
{
orderNumber = x;
company = y;
totalOrder = z;
numberOfOrders++;
ordersTotal += totalOrder;
}
public CustomerSales(int x)
{
Orders();
this.orderNumber = x;
numberOfOrders++;
}
public setCompany =new company (String)
{
company = c;
}
private void Orders() {
// TODO Auto-generated method stub

}
public void setTotalOrder(double x)
{
totalOrder += x;
ordersTotal += totalOrder;
}
public void setOrderNumber(int ord)
{
orderNumber = ord;
}
public static void incrementNumberOfOrders()
{
Orders.numberOfOrders++;
}
public static void incrementTotalOrders(double x)
{
Orders.ordersTotal += x;
totalOrder += x;
}
public static void main(String[ ] args)
{
Orders ord1 = new Orders();
Orders ord2 = new Orders(123, "ABC", 324.50);
Orders ord3 = new Orders(456);
Orders ord4;
Orders ord5 = new Orders();
ord3.setCompany("DEF");
ord3.setTotalOrder(798.75);
ord1.setTotalOrder(493.25);
ord4 = ord2;
}


}


Class 3: 
Orders 

package Orders_package;

public class Orders
{
public static int numberOfOrders = 0;
public static double ordersTotal = 0.0;
private int orderNumber;
private String company;
private double totalOrder;

public Orders()
{
orderNumber = 0;
company = " ";
totalOrder = 0.0;
numberOfOrders++;
}
public Orders(int x, String y, double z)
{
orderNumber = x;
company = y;
totalOrder = z;
numberOfOrders++;
ordersTotal += totalOrder;
}
public Orders(int x)
{
orders();
this.orderNumber = x;
numberOfOrders++;
}
private void orders()
{
// TODO Auto-generated method stub

}
public void setCompany(String c)
{
company = c;
}
public void setTotalOrder(double x)
{
totalOrder += x;
ordersTotal += totalOrder;
}
public void setOrderNumber(int ord)
{
orderNumber = ord;
}
public static void incrementNumberOfOrders()
{
Orders.numberOfOrders++;
}
public static void incrementTotalOrders(double x)
{
Orders.ordersTotal += x;
double TotalOrder = x;
}
public static void main(String[ ] args)
{
Orders ord1 = new Orders();
Orders ord2 = new Orders(123, "ABC", 424.50);
Orders ord3 = new Orders(456);
Orders ord4;
ord3.setCompany("DEF");
ord3.setTotalOrder(898.75);
ord1.setTotalOrder(593.25);
ord4 = ord2;
}

}

No comments:

Post a Comment