1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Helga [31]
3 years ago
11

Within MethodsPractice.java, write a method public static int planParty2(int f, int c, int p) that performs the same calculation

s as the previous problem, but returns the number of p-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:

Computers and Technology
1 answer:
Vesna [10]3 years ago
3 0

Answer:

// class definition of MethodPractice

public class MethodPractice {

   // main method that begin program execution

   public static void main(String args[]) {

       // call to the planParty2 method is done using some parameter

       // and the return value is displayed

     System.out.println("The number of p-packs needed is: " + planParty2(9, 14, 6));

     System.out.println("The number of p-packs needed is: " + planParty2(4, 6, 3));

     System.out.println("The number of p-packs needed is: " + planParty2(4, 6, 4));

   }

   

   // planParty2 method with 3 parameters and it return an integer

   // the calculation needed to get the required pack is done here

   public static int planParty2(int f, int c, int p){

       // the party owner is added to list of friend

       // and the value is assigned to totalPeople

       int totalPeople = f + 1;

       // the totalPeople times the can drink

       // is assigned to totalDrinkNeeded

       int totalDrinkNeeded = totalPeople * c;

       // number of packs required is declared

       int numberOfPacks;

       // if the totalDrinkNeeded contains exact multiple of a pack

       // we return the numberOfPack by dividing totalDrinkNeeded with p

       if (totalDrinkNeeded % p == 0){

           return numberOfPacks = totalDrinkNeeded / p;

       }

       // else we compute if the totalDrinkNeeded is not a multiple of a pack

       //  first we get the remainder when the totalDrinkNeeded is divided with p

       // then the needed can is computed by subtracting remainder from p

       // the neededCan is added to totalDrinkNeeded, then divided with p

       // and assigned to numberOfPacks

       // numberOfPacks is returned.

       else {

           int remainder = totalDrinkNeeded % p;

           int neededCan = p - remainder;

           numberOfPacks = (totalDrinkNeeded + neededCan) / p;

           return numberOfPacks;

       }

   }

}

Explanation:

Image showing the detailed question is attached.

The program is written in Java and is well commented. A sample image of program output when it is executed is attached.

You might be interested in
Why is there no ide length or timing for study breaks?​
Ghella [55]

Answer:

Could you add more to ur question?

4 0
3 years ago
Under what conditions might the Justice Department approve a merger between two companies that operate in an industry with a pos
pogonyaev

Answer:

Explanation:

Overall an industry with a post merger Herfindahl-Hirschman index value of below 1500 is considered un-concentrated.In an extreme case,if the Herfindahl-Hirschman index in an industry exceeds 2900,it suggest that the industry is highly concentrated.

In that case if a merger is going to occur which is expected to raise the Herfindahl-Hirschman index by 255 points,then the FTC and DOJ might challenge a lawsuit against such merger,some other factor are also scrutinized.

This include economies of scale,economies of scopes and the ease in which there is an entry possible in the industry,The agencies like FTC and DOJ try to block horizontal merger if it expected to create unsuitable economic business environment for other firms in the industry

3 0
3 years ago
A musician has recorded some initial ideas for new songs which she wishes to share with her bandmates. As these are initial idea
Ugo [173]

Answer:

1.save the audio using a low sampling rate

2.save the audio using a low bit depth

Explanation:

1. if the quality of the audio is low then the size of the audio will also be low and which will make the size of the data to be less and also easier to download

3 0
3 years ago
I can't find my grandson someone help
Artemon [7]

Answer:

i'm right here

Explanation:

grandma

8 0
2 years ago
Read 2 more answers
Ayúdenme porfa se los agradecería :c
babymother [125]

Answer:

Me podrían ayudar se lo agradecería un montón

5 0
3 years ago
Other questions:
  • ________ are the most popular method used by visitors to find web sites.
    6·1 answer
  • Advertising is organized around four distinct groups. The _____ group includes the photographers, the illustrators, video produc
    9·1 answer
  • Explain with the help of an example that family background affects the entrepreneurial behaviour of people
    12·1 answer
  • Consider a Games Expo for Children. Six competitions are laid out for the expo. Tickets are sold according to the age and gender
    11·1 answer
  • To maintain her audience's confidence in her, what should kiara not do while delivering her presentation?
    10·1 answer
  • Why is it so important to have employees who can critically think?
    7·2 answers
  • If your TV was showing a flat black or blue screen, or had "snow", what steps would you take to fix it?
    13·1 answer
  • When you are working in Performance Monitor, in the "Add Counters" dialog box, and need more information about a particular coun
    8·1 answer
  • True false.
    10·2 answers
  • 8. Choose the 3 correct statements for the code below.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!