-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSale.java
63 lines (52 loc) · 1.56 KB
/
Sale.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
Authors: Nick Barth, Nick Garcia, Kyle Bowles, Owen Leonard, Michael Gostomoski
Date: 11/18/2018
Assignment: Group Project Part 1 - Sale
Section: 2
Purpose: An application to be used by a home repair and supply shop which
can create and edit customers/contractors, create and edit vendors,
create and edit inventory items,
enter sales, print receipts, and print reports.
*/
package CIS331GroupProject;
public class Sale {
Item itemSold;
int quantity;
String date;
Customer customer;
public static int saleCount;
int saleID;
Sale(Item itemSold, int quantity, String date, Customer customer){
if(itemSold != null)
{
this.itemSold = itemSold;
}
if(quantity > 0)
{
this.quantity = quantity;
}
this.date = date;
if(!(customer.equals(null)))
{
this.customer = customer;
}
this.saleID = saleCount;
saleCount++;
}
public Customer getCustomer(){
return this.customer;
}
public void setSaleID(int saleID){
this.saleID = saleID;
}
public int getSaleID(){
return this.saleID;
}
@Override
public String toString(){
String sale = "Customer: " + customer.getName() + "\nSaleID: " + this.saleID + "\nItem: " + itemSold.itemName + " Price: $"
+ itemSold.getPrice() + "\tQuantity: " + this.quantity
+ " Sale Total: " + (itemSold.getPrice() * this.quantity);
return sale;
}
}