-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPartyManager.java
More file actions
134 lines (109 loc) · 3.87 KB
/
PartyManager.java
File metadata and controls
134 lines (109 loc) · 3.87 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
package partymanager;
import java.util.Scanner;
import java.util.ArrayList;
public class PartyManager {
/**
*
* @param args
*/
public static void main(String[] args) {
ArrayList<Persons> attendees = new ArrayList<>();
ArrayList<Supplies> supplies = new ArrayList<>();
Scanner input = new Scanner(System.in);
Boolean loadingPeople = true;
// load people
while (loadingPeople) {
Boolean loadingLikes = true;
Boolean loadingDislikes = true;
System.out.print("First name: ");
String firstName = input.nextLine();
System.out.print("Last name: ");
String lastName = input.nextLine();
Persons person = new Persons(firstName, lastName);
while (loadingLikes) {
System.out.print("Likes (blank line to end): ");
String like = input.nextLine();
if (like.isEmpty()) {
loadingLikes = false;
} else {
person.addLike(like);
}
}
while (loadingDislikes) {
System.out.print("Dislikes (blank line to end): ");
String dislike = input.nextLine();
if (dislike.isEmpty()) {
loadingDislikes = false;
} else {
person.addDislike(dislike);
}
}
attendees.add(person);
System.out.print("\nAny more people (y/n)? ");
String more = input.nextLine();
loadingPeople = (more.equals("y"));
}
// create supplies
boolean gettingSupplies = false;
boolean gettingDescription = true;
System.out.println("\nLet's add some supplies.");
do
{
Supplies supply = new Supplies();
String name;
int amount;
String type;
String description;
String descriptionLine;
System.out.print("New supply name: ");
name = input.nextLine();
supply.setItem(name);
System.out.print("What kind of supply?: ");
type = input.nextLine();
supply.setItemType(type);
System.out.print("How many?: ");
amount = input.nextInt();
supply.setAmount(amount);
input.nextLine();
description = "";
do
{
System.out.print("What is it for?: ");
descriptionLine = input.nextLine();
if(descriptionLine.isEmpty())
{
gettingDescription = false;
}
else
{
description += descriptionLine;
}
}
while(gettingDescription == true);
supplies.add(supply);
System.out.print("Any more supplies?(y/n): ");
String more = input.nextLine();
if(more.equals("n"))
{
gettingSupplies = false;
}
}
while(gettingSupplies == true);
// dump list of attendees
System.out.println("\n\nParty Attendees:");
for(Persons person: attendees) {
System.out.println(person.getFullName());
}
// dump list of supplies people like
System.out.println("\nPeople's Likes:");
for(Persons person: attendees) {
System.out.println(person.getLikesList());
}
// dump list of supplies people don't like
System.out.println("\nPeople's Dislikes:");
for(Persons person: attendees) {
System.out.println(person.getDislikesList());
}
// Print supplies
}
}