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
lara [203]
3 years ago
14

You're a short-order cook in a pancake restaurant, so you need to cook pancakes as fast as possible. You have one pan that can f

it capacity pancakes at a time. Using this pan you must cook pamCakes pancakes. Each pancake must be cooked for five minutes on each side, and once a pancake starts cooking on a side it has to cook for five minutes on that side. However, you can take a pancake out of the pan when you're ready to flip it after five minutes and put it back in the pan later to cook it on the other side. Write the method, minutes Needed, that returns the shortest time needed to cook numCakes pancakes in a pan that holds capacity pancakes at once.
Computers and Technology
1 answer:
Zina [86]3 years ago
8 0

Answer:

Explanation:

The shortest time needed means that we are not taking into account the amount of time it takes to switch pancakes, flip them, or take them out of the pan, etc. Only cooking them. Therefore, written in Java would be the following...

public static int minutesNeeded (int numCakes, int panCapacity) {

       int minutesNeededtoCook = 0;

       while (numCakes != 0) {

           if (numCakes > panCapacity) {

               numCakes -= panCapacity;

               minutesNeededtoCook += 10;

           } else {

               numCakes = 0;

               minutesNeededtoCook += 10;

           }

       }

       return minutesNeededtoCook;

   }

The code takes in the amount of pancakes and the pan capacity, then compares them and adds 10 minutes (5 on each side) per pancake batch that is being made until all the pancakes are made.

You might be interested in
There are 55 registers, and total 60 instructions available in a general-purpose computer. The computer allows only 2-address in
Andrei [34K]

Answer:

31 bits.

Explanation:

Given, total number of registers = 55

Total instructions = 60

Size of memory = 16 KB

Now, no of registers are 55. We find the next greater or equal power of 2 which is 64 = 26. Hence, 6 bits are required to represent a register operand.

Number of instructions = 60. We find the next greater or equal power of 2 which is 64 = 26. Hence, 6 bits are required to represent a instruction.

Size of memory = 64 KB = 26 * 210 * 23 bits = 219 bits. Hence, 19 bits are required to represent a memory location.

Now, an instruction has 2 parts, opcode and operand. As given there are only two address instructions which are memory operand and register operand.

Hence, total bits would be: 6 bits (opcode) + 6 bits (register operand) + 19 (memory operand) = 31 bits.

7 0
3 years ago
When a cardholder successfully contests a charge, the acquiring bank must retrieve the money it placed in the merchant account i
lions [1.4K]

Answer:

Charge back.

Explanation:

A chargeback is a charge that is returned to a payment card after a customer successfully disputes an item on their account transactions report. Simply put, it is the reversal of a credit card payment that comes directly from the bank.

Most commonly the payer is a consumer.

A chargeback may occur on bank accounts or credit cards. They can be granted to a cardholder for a variety of reasons. A chargeback can be considered a refund since it returns specified funds taken from an account through a prior purchase. Chargebacks are focused on charges that have been fully processed and settled. Chargebacks can often take several days for full settlement as they must be reversed through an electronic process involving multiple entities.

The chargeback is ordered by the bank that issued the consumer's payment card.

6 0
3 years ago
When you think of computers, I want you to think:
jekas [21]

Answer:

Explanation:

When I think about computers, I can understand about the software and the hardware, we can touch the hardware, but the software don't because is only data stored in the hardware, we can interact with the stored data using the hardware, we can complete a system with data, software, hardware, and people, people try to learn about software because it is better paid than fix a hardware.

5 0
3 years ago
Why might a variable used for output have to be of a different type then a variable used for input?​
telo118 [61]

Answer:

You may use a different variable type for input in order to process the data appropriately and may use a different variable type to accommodate your program.

Explanation:

Your input may have to be different then output varying on what data you are processing.

For example, just like the last question you asked about calculating the area of the rectangle, your input MUST be converted to a different a numerical data type (i.e int or float) in order to do the math.

Based on your last question, if we didn't convert your input into a string your results wouldn't add the numbers together but only concatenate them. If I typed 3 & 5 as length & width, I would get 35 instead of 15.

Now another example is using functions (or methods whatever you want to call them), your input can be one thing and outputs another.

Let's say I want a function to tell me if I am smart. The way I want it to determine if its smart is by inputting my GPA into it, which is a numerical value. So the function would look something like this:

<u>Code (Python)</u>

def IsSmart(gpa):

  if (gpa >= 4):

       return True

  else

       return False

As you can see I am inputting a numerical value and it is outputting a boolean value. I can use this in a if else chain to spit out an output to the user.

7 0
3 years ago
Write a Python program string_functions.py that defines several functions. Each function re-implements Python's built-in string
grigory [225]

Answer:

def my_compare(str1, str2):

   mylist = sorted([str1, str2])

   if str1 == str2:

       return 0

   elif str1 == mylist[0]:

       return -1

   elif str1 == mylist[1]:

       return 1

def is_char_in(string, char):

   if char in string:

       return True

   return False

def is_char_not_in(string, char):

   if char not in string:

       return True

   return False

def my_count(string, char):

   return string.count(char)

def my_endswith(string, char):

   return string.endswith(char)

def my_find(string, char):

   if char in string:

       return string.index(char)

   else:

       return -1

def my_replace(string, char1, char2):

   lst = [i for i in string]

   print(lst)

   for i, v in enumerate(lst):

       if v==char1:

           lst[i] = char2

   return "".join(lst)

Explanation:

Above are defined functions similar to the string built-in functions in python. To use them, type in the function name and pass in the required arguments. Save the file name as "string_functions" with a ".py" file extension and use the functions in other files by importing all the function as "import string_functions" or import individual functions with "from string_function import 'function_name' ".

5 0
3 years ago
Other questions:
  • On an Android device, where can a user find the correct app to use to sync contacts and apps among devices?
    10·1 answer
  • 2. How do web bugs invade a person’s privacy?
    10·2 answers
  • A key requirement for the process of testing hypotheses in the scientific method is Group of answer choices experimenter bias. c
    9·1 answer
  • What led to fall of axum?
    15·2 answers
  • Write a program that prompts the user to enter a password and displays "valid password"
    11·1 answer
  • 2. How do cell phone users stay connected to the network as users move between cells?
    10·1 answer
  • Write a SELECT statement that returns the same result set as this SELECT statement. Substitute a subquery in a WHERE clause for
    13·1 answer
  • You have a spreadsheet of x values that need to
    15·2 answers
  • What is not recyclable in a<br> hybrid car<br> hydrogen car<br> petrol car
    15·1 answer
  • What does a companys code of ehtics cover
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!