File tree 3 files changed +25
-25
lines changed 3 files changed +25
-25
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ public static void main(String[] args)
31
31
{
32
32
getGuests ();
33
33
displayMotto ();
34
- // displayEvent(guests);
34
+ displayEvent (guests );
35
35
}
36
36
public static int getGuests ()
37
37
{
@@ -44,16 +44,13 @@ public static String getEventNumber()
44
44
getEventNumber ();
45
45
return getEventNumber ();
46
46
}
47
- public static void displayEvent (Event object )
47
+ public static void displayEvent (int guests )
48
48
{
49
49
boolean isLargeEvent = (guests > 49 );
50
- totalBill = guests * PRICE_PER_GUEST ;
51
-
52
- System .out .println ("Number of guests attending: " + guests );
50
+ System .out .println ("Number of guests attending: " + getGuests ());
53
51
System .out .println ("Price Per Guest: " + PRICE_PER_GUEST );
54
52
System .out .println ("Total Bill: " + totalBill );
55
53
System .out .println ("Is this a large event: " + isLargeEvent );
56
-
57
54
}
58
55
public static void displayMotto ()
59
56
{
Original file line number Diff line number Diff line change 20
20
*/
21
21
public class Event
22
22
{
23
- public static final double PRICE_PER_GUEST = 35.00 ;
23
+ public static double pricePerGuestHigh = 35.00 ;
24
+ public static double pricePerGuestLow = 32.00 ;
24
25
public static final int LARGE_EVENT_MAX = 50 ;
25
26
private String eventNumber ;
26
27
private int guests ;
27
- private double totalBill ;
28
-
29
- //TODO and fields, constructors, and methods;
30
- public static void main (String [] args )
31
- {
32
- //TODO add methods;
33
- }
28
+ private double pricePerEvent ;
29
+
30
+
31
+
34
32
public void setEventNumber ()
35
33
{
36
34
Scanner enter = new Scanner (System .in );
@@ -42,18 +40,26 @@ public void setGuests()
42
40
Scanner enter = new Scanner (System .in );
43
41
System .out .println ("Enter the number of guest attending " );
44
42
guests = enter .nextInt ();
45
- totalBill = guests * PRICE_PER_GUEST ;
46
43
}
47
- public String getEventNumber ()
44
+ public boolean isLargeEvent ()
48
45
{
49
- return eventNumber ;
46
+ if (guests >= LARGE_EVENT_MAX )
47
+ {
48
+ return true ;
49
+ }
50
+ else if (guests < LARGE_EVENT_MAX )
51
+ {
52
+ return false ;
53
+ }
54
+ return isLargeEvent ();
50
55
}
51
- public int getGuests ()
56
+
57
+ public String getEventNumber (int guests )
52
58
{
53
- return guests ;
59
+ return eventNumber ;
54
60
}
55
- public double getPrice ( )
61
+ public int getGuests ( boolean largeEvent )
56
62
{
57
- return totalBill ;
63
+ return guests ;
58
64
}
59
65
}
Original file line number Diff line number Diff line change 22
22
*/
23
23
public class EventDemo
24
24
{
25
-
26
25
public static void main (String [] args )
27
26
{
28
27
Event test001 = new Event ();
29
28
test001 .setEventNumber ();
30
29
test001 .setGuests ();
31
- test001 .getPrice ();
32
30
CarlysEventPriceWithMethods .displayMotto ();
33
- CarlysEventPriceWithMethods .displayEvent (test001 );
34
-
31
+ CarlysEventPriceWithMethods .displayEvent (Integer .parseInt (test001 .getEventNumber (test001 .getGuests (test001 .isLargeEvent (test001 .getPrice ())))));
35
32
}
36
33
}
You can’t perform that action at this time.
0 commit comments