forked from ghostmkg/programming-language
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathassignmentTest.java
More file actions
Latest commit
90 lines (59 loc) · 2.85 KB
/
Copy pathassignmentTest.java
File metadata and controls
90 lines (59 loc) · 2.85 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
packageAssignment;
importjava.util.ArrayList;
publicclassassignmentTest
{
publicstaticvoidmain(String[] args)
{
//ArrayList object
ArrayList <Animal> animals = newArrayList<>();
//Object declaration
DateTdate = newDate(4, 10, 2023);
Datedate = newDate(3, 03, 2023);
//animal's objects
Animala = newAnimal("Cow", "An-123", "white", 500.0 , 400.0, date , 5000 , false);
Animala1 = newAnimal("Cow", "An-124", "white", 2000.0 , 400.0, date , 5000 , false);
//Dealer's objects
Dealerd = newDealer("Wasiq Tanveer", "14301-2345867-6", "Seni Gumabt", "0345-9655464", 10.0, a, animals);
Dealerd1 = newDealer("Wasiq Tanveer", "14301-2345867-6", "Seni Gumabt", "0345-9655464", 10.0, a1, animals);
//seller's objects
Sellers = newSeller("Imran Khan", "14301-2354965-7", "Peshawar", "0335-3344545", 25.0, 17.0, a);
Sellers1 = newSeller("Imran Khan", "14301-2354965-7", "Peshawar", "0335-3344545", 25.0, 17.0, a1);
//buyer's objects
Buyerb = newBuyer("Nazim Ullah", "14301-1232353-2", "Islamabad","0349-2354569", a , Tdate);
Buyerb1 = newBuyer("Nazim Ullah", "14301-1232353-2", "Islamabad","0349-2354569", a1, Tdate);
//invoice objects
Invoicei = newInvoice(b, d, a, s);
Invoicei1 = newInvoice(b1, d1, a1, s1);
//making an array that print details in loop
/*since all the classes implement a common interface
(ManageFinance)there for we use MaintainFinance in the loop
so that we can access their objects through the interface*/
MaintainFinance [] loop = {i, i1};
for(MaintainFinancej : loop)
{
System.out.println(j.toString());
}
// d1.manageFinance();
//declaring animals objects
Animalanimal1 = newAnimal("goat", "An-153", "Light Brown", 150.0 , 400.0, date , 5000 , false);
Animalanimal2 = newAnimal("sheep", "An-145", "Brown", 110.0 , 400.0, date , 5000 , false);
Animalanimal3= newAnimal("camel", "An-134", "Black", 990.0 , 400.0, date , 5000 , false);
//adding animals objects to dealers Array list
animals.add(animal1);
animals.add(animal2);
animals.add(animal3);
// Printing all the added animals
//d.displayObjects();
//adding animal
//d.addAnimal(animal3);
//checking the animal's avalibility
//System.out.println(d.contains("An-153"));
//printing all the objects individually
// System.out.println(d);
// System.out.println(a);
// System.out.println(s);
// System.out.println(b);
//printing all the info including invoice
// System.out.println(i);
}
}