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
Maurinko [17]
3 years ago
9

6.16 LAB: Find largest number (EO) Write a method, findMax(), that repeatedly reads in integers until a negative integer is read

and keeps track of the largest integer that has been read. findMax() then returns the largest number entered. Ex: If the input is: 2 77 17 4 -1 the findMax() returns and the program output is: 77 Assume a user will enter at least one non-zero integer. Note: Your program must define the method: public int findMax()
Computers and Technology
1 answer:
Zolol [24]3 years ago
7 0

Answer:

Explanation:

The following code is written in Java, it creates and tests the findMax() method with the test inputs provided in the question. The method loops through asking the user for inputs, if a positive number is passed it checks if it is larger than the previous numbers and if so, saves it in a variable called max. Otherwise it breaks the loop and returns the variable max. The test output can be seen in the attached picture below.

import java.util.Scanner;

class Brainly {

   public static void main(String[] args) {

       System.out.println("Max number is: " + findMax());

   }

   public static int findMax() {

       int max = 0;

       Scanner in = new Scanner(System.in);

       while (true) {

           System.out.println("Enter a number: ");

           int num = in.nextInt();

           if (num >= 0) {

               if (num > max) {

                   max = num;

               }

           } else {

               break;

           }

       }

       return max;

   }

}

You might be interested in
On the Direct Marketing worksheet, create appropriate range names for Design Fee (cell B8), Cost Per Ad (cell B9), Total Clicks
Inessa [10]

Answer:

See explanation below

Explanation:

Named ranges are a very important tool in Microsoft Excel. It is used in assigning a name to a particular number of cells. It is great for automation and makes formula much easy to understand and use.

One way to create named ranges is theory the Name Box.

To create named ranges in the design marketing sheet we do this;

1) We click on cell B8 and then navigate to the name box at the top right corner of the sheet just above the column A.

•The name box is where the cell address of any cell that is active is displayed.

•You would see that “B8” is displayed on the name box.

• Double click on the name box and type in the appropriate name, in this case - Design_Fee.

• Press enter and you have your named range.

You do the same for the other named ranges.

Note that: Named ranges must contain letters, numbers or underscore.

4 0
3 years ago
If the user loads this graphic in a text only browser how will the browser describe it?
charle [14.2K]

Im going to say probably not, it wont be able to describe it but it'll search it up and show what others match the image

8 0
3 years ago
Read 2 more answers
in cell reference if you copy formula to another cell the cell reference to the formula will change according​
Grace [21]

Answer:

the type of reference

Explanation:

There are many cell reference types eg relative,absolute and mixed cell referencing. if you write your cell reference in relative type then it will change as you copy it to another cell. if you select absolute cell referencing then it will not change if you copy to another cell.

4 0
3 years ago
What is it called when you make predictions within given data?
denis23 [38]
<span>When a researcher uses given data to make a prediction, this is known as a hypothesis. The hypothesis generally serves as a starting point for future research, allowing a researcher to further develop their theory through additional testing, observation, and, if necessary, revision to the current hypothesis.</span>
4 0
3 years ago
Technician A says aluminum cylinder head surfaces should be scraped clean only with nonmetallic tools to avoid gouging. Technici
fredd [130]
<span><span><span /></span></span>Both Technicians (A and B) are correct since the aluminum cylinder head surfaces should be scraped clean only with nonmetallic tools to avoid gouging and it should also be chemically cleaned in accordance with the manufacturer's recommendations before the inspection.<span><span /></span>
6 0
3 years ago
Read 2 more answers
Other questions:
  • Consider the following scenario: "You are an assistant to the accounting manager for a small company that sells sports equipment
    5·1 answer
  • G=D+(A+C^2)*E/(D+B)^3 Rewrite the above formula in terms of doing concurrent processing using cobegin and coend to identify thos
    12·1 answer
  • How do you ask someone for help?
    6·1 answer
  • How many electrons are there in an atom of carbon? A. Four B. Eight C. Six D. One
    15·2 answers
  • Which of the following is NOT a destination?
    12·2 answers
  • Can you guys help me plz <br> I want c++ code
    12·1 answer
  • What is application software used for
    13·1 answer
  • Help please!! worth 10 pts! answer quick please!
    12·1 answer
  • What was software for modems that connected through phone lines called?
    6·1 answer
  • Write a program which will enter information relating to a speeding violation and then compute the amount of the speeding ticket
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!