-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSale.java
More file actions
52 lines (44 loc) · 1.36 KB
/
Sale.java
File metadata and controls
52 lines (44 loc) · 1.36 KB
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
/*
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;
int id;
Sale(Item itemSold, int quantity, String date, Customer customer, int uniqueID){
if(itemSold != null)
{
this.itemSold = itemSold;
}
if(quantity > 0)
{
this.quantity = quantity;
}
this.date = date;
if(!(customer.equals(null)))
{
this.customer = customer;
}
this.id = uniqueID;
}
public Customer getCustomer(){
return this.customer;
}
@Override
public String toString(){
String sale = "Customer: " + customer.getName() + "\nSaleID: " + this.id + "\nItem: " + itemSold.itemName + " Price: $"
+ itemSold.getPrice() + "\tQuantity: " + this.quantity
+ " Sale Total: " + (itemSold.getPrice() * this.quantity);
return sale;
}
}