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
Determine the value of X if (211) base x = (152) base 8, how to do this?
Alex
 we translate the following statement given in terms of logarithms. 211 base x can be expressed into log 211 / log x while 152 base 8 can be expressed int o log 152 over log 8. In this case,
log 211 / log x = log 152 / log 8log x = 0.962x = 10^0.962 = 9.1632
7 0
3 years ago
I WILL UPVOTE!!!!!!!!!!!!!!!!!!
BabaBlast [244]
All of the answers above are correct
5 0
3 years ago
Question 83 :Which type of fiber optic connector connects to a terminating device by pushing the connector into the terminating
STALIN [3.7K]

The Lucent connector(LC) is a type of fiber optic connector used here.

Explanation:

A Lucent connector (LC) is a type of fiber optic connector connects to a terminating device by pushing the connector into the terminating device and can be removed by depressing the tab on the connector and pulling it out of the terminating device.

It is a standard ceramic Ferrule connector and has good performance and is favored for single mode.

LC is a latched connector which have same handling capacities like SC. They have small flange on top similar to an RJ-45 connector that aids secure connection. It has a smaller connector housing and a smaller 1.25 mm ferrule.

3 0
3 years ago
All the concrete classes in the java collections framework implement _____________. the cloneable interface the comparable inter
liubo4ka [24]
Since java.util.PriorityQueue doesn't use the Cloneable interface, I think it's safe to say that Serializable interfaces are implemented in all instances.
8 0
3 years ago
How many pins are typical molex connector?
kondor19780726 [428]
There are 4 connectors, from left to right the pins are +5v ground ground +12v
5 0
3 years ago
Other questions:
  • Which is an internet service?<br><br> Antivirus<br> Chat<br> Firewall<br> Router
    8·2 answers
  • Please Help!!!<br> I keep getting this answer wrong
    10·1 answer
  • Violations of security policies are considered to be a(n) __________ issue upon which proper disciplinary actions must be taken.
    7·1 answer
  • Which of the following does not make a good analysis class? (Points : 6) its name reflects its intent
    13·1 answer
  • Random Access Memory is tempory computer memory that stores works in progress
    7·1 answer
  • 5. An entrepreneur who continues to find new and better ways of doing things is ____.
    10·1 answer
  • Is mayonnaise technically an instrument?
    9·1 answer
  • Write a program that produces an expense report for a trip to Lagos, Nigeria. Use the Internet to research the cost to travel to
    13·1 answer
  • What are the characteristics of Instant Search in Outlook 2016? Check all that apply. A)Typing whole phrases makes your search m
    12·1 answer
  • GUYS THERE IS A HACKER IN BRAINLY PLEASE DONT PRESS ON THE WEBSITE THEY WILL HACK YOU.
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!