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]
3 years ago
13

Write a function in Java to implement the following logic:

Computers and Technology
1 answer:
galben [10]3 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
Why won't Brainly let me create an account? I have tried many times but it just loads.
Alex73 [517]

Answer:

Try checking your location or number

8 0
2 years ago
How many data bits are sent in a single psk31 character?
ololo11 [35]
I would say the number varies.
8 0
3 years ago
The advancements in which of the following technologies has most changed the American job market in recent years?
vodka [1.7K]

Answer:

Manufacturing mostly

7 0
3 years ago
Read 2 more answers
________ is interpreted. Group of answer choices A. Python B. C C. C D. Ada E. Pascal
rusak2 [61]

The interpreted are;

  • A. Java
  • B. C++
  • D. C#
<h3>What is interpreted programming language?</h3>

An interpreted language is known to be a kind of languagewhere its implementations often carry out or execute instructions directly.

Note that The interpreted are;

  • A. Java
  • B. C++
  • D. C#

Learn more about Java from

brainly.com/question/25458754

#SPJ11

7 0
2 years ago
COMO HA SIDO LA INNOVACION DE ESTE OBJETO TECNOLOGICO DURANTE SU EVOLUCIÓN
Marizza181 [45]

Answer:

Cual es el objeto tecnologico?

Explanation:

Si dices Cual,puede ser que te ayude.

3 0
3 years ago
Other questions:
  • Host A and B are directly connected with a 100 Mbps link. There is one TCP connection between the two hosts, and Host A is sendi
    14·1 answer
  • Jeremy wishes to create a site map for his website. What tag will surround the URL of his home page? A. B. C. D.
    8·1 answer
  • Write a couple of paragraph on 'limited government and its important'?​
    7·1 answer
  • As an improvement of the ATX form factor over AT, shorter wires made it easier to shield them and made them capable of handling
    6·1 answer
  • When targeting customers of the consumer population at market a product, what type of segmentation information would be most hel
    12·2 answers
  • What is the main difference between a search engine and a web browser?
    6·2 answers
  • Creating Classes
    10·1 answer
  • Question 1 of 20 Gus has decided to organize his inbox on June 26 by using folders and deleting irrelevant messages. He creates
    14·2 answers
  • Select the correct answer from the drop-down menu.
    15·2 answers
  • A network of computers that provides access to information on the web.
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!