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
Allen needs a program that injects automatically semi-random data into a program or stack and detects bugs. What will he use?
Goryan [66]

Answer:

A) fuzzer

Explanation:

From the question, we are informed that Allen needs a program that injects automatically semi-random data into a program or stack and detects bugs. In this case,he will use a fuzzer. A fuzzer can be regarded as a program that gives in a semi-random data to a program/stack, and it will detect bug. fuzzing testing can be regarded as

software testing process which discover bugs in the software, this is done automatically by giving in input of randomized data to the computer program. Generation of data is done by a generator, while vulnerability identification depends on the tools use in the debugging process.

8 0
3 years ago
In the context of customer relationship management (CRM) applications, which approach is often chosen by organizations with an e
Bad White [126]

The on-premise approach is often chosen by organizations with an established IT infrastructure.

<h3>What is the On Premises?</h3>

In an on-premises method, resources are said to be given or deployed in-house and it is one that is found within an enterprise's IT infrastructure.

Customer relationship management (CRM) is known to be a form of a technology that is often used in the act of managing all of a firm's  relationships and communications with customers and also that of potential customers.

Therefore, The on-premise approach is often chosen by organizations with an established IT infrastructure.

Learn more about CRM from

brainly.com/question/27373018

#SPJ1

5 0
2 years ago
Which is many many years of vot in nepal.​
Butoxors [25]

Answer:

18 yrs

Explanation:

3 0
3 years ago
The help desk for company XYZ received a call from a user who could not locate their company-issued smart phone device. The netw
Gnoma [55]

Answer:

In the given scenario, the user may have disabled the profile on the device. That is why the help-desk would not be able to lock the device remotely through the software.

Explanation:

A device can only be located and locked via the MDM software if the profile of the software is active on the device. Else if the profile is disabled there is no more access for the software to the device.

7 0
3 years ago
In the value chain concept, upgrading IT is considered what kind of activity?
ANTONII [103]

Answer:

Upgrading IT is considered as B. Support activity

Explanation:

It is considered as support activities because they help the primary activities move smoothly and consistently.

For example, efficient communication between a particular firm and its subsidiaries will be extremely difficult without the necessary IT infrastructure, which will slow down the primary activities that are to be carried out.

6 0
3 years ago
Other questions:
  • Which country does coriander come from
    11·2 answers
  • A mobile device is freezing almost daily. The device remains powered on and the screen illuminated. The user restarts the device
    13·1 answer
  • True or false a computer network requires both hardware and software
    9·2 answers
  • What is another name for a computer on network
    8·1 answer
  • What is the 4-digit code?
    14·1 answer
  • Write a program that implements a class called Dog that contains instance data that represent the dog's name and age. • define t
    10·1 answer
  • What is the exclusive legal right granted to all authors and artists that gives them sole ownership of their work to print, publ
    5·2 answers
  • The metric unit used for length
    5·1 answer
  • Who would benefit from using self-driving cars
    10·2 answers
  • A wide-angle lens corrected for barrel distortion is called a(n)<br> lens.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!