Question
create a new file named MethodsPractice.java. A)-->>Within MethodsPractice.java, write a method named planParty(int f, int c, int p) that computes and displays the number of
A)-->>Within MethodsPractice.java,write a method named planParty(int f, int c, int p)that computes and displays the number ofp-packs needed to supply a party for you andfof your friends, each of whom will drinkccans. The method should also compute and display how many extra cans youll have. Note that this method should onlyprintits results on the screen; it does notreturnany value.
Here are some example arguments for the planParty method and their expected output on the screen:
Arguments | Output on Screen |
(9, 14, 6) | 24 pack(s) needed 4 extra can(s) |
(4, 6, 3) | 10 pack(s) needed 0 extra can(s) |
(4, 6, 4) | 8 pack(s) needed 2 extra can(s) |
B)--->> Within MethodsPractice.java,write a method named planParty2(int f, int c, int p)that performs the same calculations as the previous part, butreturnsthe number ofp-packs needed. planParty2 does not need to consider the number of extra cans, and it should not print anything.
Here are some example arguments for the planParty2 method and their expected return values:
Arguments | Return Value |
(9, 14, 6) | 24 |
(4, 6, 3) | 10 |
(4, 6, 4) | 8 |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started