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
Which of the following is NOT a name of one of the central features of Facebook? Timeline Activity Log Graph Search Daily News
Thepotemich [5.8K]
I think it's Graph Search because there isn't any graphs in Facebook. That is my opinion. I don't use social media.
4 0
3 years ago
Which results are expected in a personality test but not a skills assessment?
dimaraw [331]

Answer:

openness, conscientiousness, extraversion

Explanation:

A personality test is defined as a test that is used to assess the human personality. It is designed as the techniques to measure characteristics patterns of the traits that various people shows at different situations or environments.

A skill assessment test is used to test the abilities and the skill sets of people to perform a particular tasks given to them. It is measuring the knowledge and skills of a person.

The personality test are carried out to test how human behave and what traits they show in certain conditions. Thus openness, extra version and conscientiousness are some of the traits that people usually shows in a personality test. Thus they are the results that are expected by an individual of a personality test.

6 0
2 years ago
Where should you endorse a check
yKpoI14uk [10]
This is done by signing your name on the back of the left end of thecheck<span>. </span>You<span> can also limit who can cash it by specifying in your </span>endorsement<span> that it is only to be deposited into your specified account at Provident.</span>
5 0
2 years ago
Read 2 more answers
solve all and i.will try to make u Brainiest (tagdi picture that I have sended so that you can see this full question)​
Elis [28]

Answer: 1) Charles W 2) Charlie Bachman 3) MDB 4) the navigation pane

5) you can count the number of values in a range or table by using a simple formul, clicking a button or by using a worksheet function 6) save database - CTRL + S. open an existing database - CTRL + O. Rename a table - alt + JTA. Quit MS Access - CTRL + F4.

7 0
3 years ago
The term used to describe the shape and layout of a computer component such as a motherboard or hard drive is ______ factor.
Olegator [25]
The answer is form factor
8 0
3 years ago
Other questions:
  • P3. In Section 4.2 , we noted that the maximum queuing delay is (n–1)D if the switching fabric is n times faster than the input
    8·1 answer
  • HELPPPP!!
    8·2 answers
  • The sample remote access policy document from the hospital that you reviewed in the lab showed that the Remote Access Domain is
    15·2 answers
  • Don is visiting digital stores and searching the internet to learn about high-definition DVD players before he buys one. This is
    8·1 answer
  • When you _____ a scroll bar, a shortcut menu appears with commands related to the scroll bar
    10·1 answer
  • What types of tools are used in the process of a digital or network investigation?
    12·1 answer
  • Evie clicks through her presentation slides and realizes they all have transition effects coming from the same location, from th
    13·1 answer
  • Here's something random idc
    8·2 answers
  • A small business named Widgets, Inc. has hired you to evaluate their wireless network security practices. As you analyze their f
    13·1 answer
  • How do you create a function in C++
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!