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
This process can be applied to help workers choose the best telecommunications technology to do a specific task.
Lisa [10]
B. Internet Telephony would be my best guess. I'm not that good with computers. Hope this Helps :-)
4 0
3 years ago
Read 2 more answers
Arrange the steps in the process of manually installing software.
Ahat [919]

The correct sequence is: 5,3,1,4,2

When you are installing software on your computer you need to first open the CD-ROM and then insert the installation CD into the CD-ROM. If the contents of the CD opens, click on the executable file to start the wizard, and then follow the prompts in the wizard. Finally, you often need to reboot your computer after installing a new program.

5 0
3 years ago
NEED DONE ASAP Which option in the Insert Table dialog box should you check if you want smaller tables to fit on a single page?
Damm [24]
The correct answer is Border
3 0
3 years ago
Read 2 more answers
What is one similarity between low-and high-level programming languages? (5 points)
aleksandr82 [10.1K]

Answer:

Both high and low level computer languages are used to communicate directly with a computer, so the answer is D.

Explanation:

5 0
3 years ago
Generally, websites ending in .edu, .gov, and .org are less likely to be biased, or to show preference toward a certain financia
svetlana [45]

Answer:

True

Explanation:

Domain extensions always appear at the end of a website's address.

It's a means to categorise websites.

.edu domains are used for educational purposes

.gov are restricted to by government entities

.org is largely used by nonprofit websites.

While

.net is derived from the word network, indicating it was originally intended for organizations involved in networking technologies, such as Internet service providers and other infrastructure companies

.biz is intended for registration of domains to be used by businesses

The right domain extension adds credibility and memorability to your website by aligning it with a specific brand purpose.

8 0
3 years ago
Other questions:
  • In what year did commercial use of the Internet become available? 1991 1996 1999 2001
    9·1 answer
  • Suppose you are currently in the /home/hnewman/os/fall/2013 directory and would like to navigate to /home/hnewman/discreteStruct
    9·1 answer
  • Which type of graph or chart will you use to show changes in data points?
    5·1 answer
  • _______ view focuses on the text and content of a document, without much information on the page layout.
    7·1 answer
  • HELP 25 POINTS!!!!!
    6·2 answers
  • Write a program in Python that reads in investment amount, annual interest rate, and number of years, and displays the future in
    6·1 answer
  • Most hard drives are divided into sectors of 512 bytes each. Our disk has a size of 16 GB. Fill in the blank to calculate how ma
    9·1 answer
  • How does the system work for this:
    15·2 answers
  • The most effective technique of malware propagation among the following list
    7·1 answer
  • What are the two compatibility issues that may arise between computer systems while transferring presentations? different video
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!