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
vodomira [7]
2 years ago
13

Write a function in Java to implement the following logic:

Computers and Technology
1 answer:
galben [10]2 years ago
8 0

Answer:

Explanation:

The following Java code basically divides the goal size by 5 and rounds the answer to the lowest whole number. Then multiplies that answer by 5 and goes adding 1 until the exact goal size is met. If the value is passed then that means that using the current brick sizes it is not possible to make the goal. Otherwise, it will print out that it is possible.

import java.io.*;

import java.util.Scanner;

public class Main{

       public static void main(String args[]) throws IOException {

               String answer = "No, it is not possible";

               Scanner in = new Scanner(System.in);

               System.out.println("Enter goal size: ");

               float goalSize = in.nextFloat();

               float currentSize = (float) Math.floor(goalSize / 5);

               currentSize = currentSize * 5;

               while (true) {

                       if (currentSize < goalSize) {

                               currentSize += 1;

                       } else if(currentSize == goalSize) {

                               answer = "Yes, it is possible";

                               break;

                       } else {

                               break;

                       }

               }

               System.out.println(answer);

       }

You might be interested in
How does your ability to correctly count change affect the impression the customer has of you?
Aloiza [94]

The skills leaves a good impression of being intelligent and analytical on the customers.

<h3>What is the ability about?</h3>

The ability to correctly count means the skills of counting or calculating numbers, money, product correctly at first attempt.

In conclusion, the skills leave a good impression of being intelligent and analytical on the customers.

Read more about counting skills

<em>brainly.com/question/17889617</em>

6 0
1 year ago
What is the output of the following program?
wlad13 [49]

Answer:

$600

Explanation:

4 0
2 years ago
Electromagnetic waves used in ovens and cell phone communications are called
Lera25 [3.4K]
<span>Microwaves are what  their called but im not for sure</span>
5 0
2 years ago
Which term refers to the capability of a switch to copy data from any or all physical ports on a switch to a single physical por
pantera1 [17]

Answer:

The correct answer to the following question will be "Port mirroring".

Explanation:

A network traffic analysis tool, recognized as the Port Mirroring.

  • Also known as the Switch port analyzer.
  • The switch transfers a replica among all networking transmissions viewed on one port (or even a whole VLAN) to the next port, wherein the packet could be evaluated, through port mirroring disabled.

Therefore, Port mirroring is the right answer.

3 0
3 years ago
Question #3
r-ruslan [8.4K]
A deque is a type of list
8 0
2 years ago
Read 2 more answers
Other questions:
  • True or false the primary advantage of the worksheet is the ability to solve numerical problems quickly and accurately
    11·1 answer
  • Computing devices translate digital to analog information in order to process the information
    8·1 answer
  • A ____________ is a network connection that typically carries encrypted data over the Internet to and from a remote access serve
    13·1 answer
  • Use the drop-down menus to describe how Adnan can add shapes to his presentation.
    11·1 answer
  • Lets say if my computer shut down every 10 minutes. What can you do to solve the problem. Hint: Use these word in you answer: ha
    10·2 answers
  • <img src="https://tex.z-dn.net/?f=%20%5Cfrac%7Bx%7D%7B1%20%2B%20x%7D%20%20%2B%20%20%5Cfrac%7Bx%20%2B%201%7D%7Bx%7D%20%20%3D%20%2
    15·2 answers
  • How many clients has<br> Accenture engaged globally on blockchain?
    12·1 answer
  • The inFS.open(str) function has a string parameter str that specifies the _____ of the file to open.
    10·1 answer
  • 1. Software that is designed to intentionally cause harm to a device, server, or network is A. outware B.loggerware C.
    12·1 answer
  • Fill in the Blank
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!