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()

Answers

Answer 1

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;

   }

}

6.16 LAB: Find Largest Number (EO) Write A Method, FindMax(), That Repeatedly Reads In Integers Until
Answer 2

Answer:

import java.util.Scanner;

public class LabProgram {

  public static void main(String[] args) {

      System.out.println(findMax());

  }

  public static int findMax() {

      int max = 0;

      Scanner in = new Scanner(System.in);

      while (true) {

          int num = in.nextInt();

          if (num >= 0) {

              if (num > max) {

                  max = num;

              }

          } else {

              break;

          }

      }

      return max;

  }

}

Explanation: this is the zybooks answer


Related Questions

Write an algorithm that accepts two numbers,
divide the first number by the second and display the
quotient

Answers

Let’s write the algorithm in the form of a pseudocode!

Pseudocode:Quotient_of_Two_Number
Declare: num1, num2, quotient
START
Display (Enter a number)
Read num1
Display (Enter a number)
Read num2
quotient = num1/num2
Print (“Quotient”)
STOP

What is computer code?
A. Java Script
B. XML
C. HTML
D. Any programming language

Answers

Answer:

D

Explanation:

Used for monitoring web activity by users to make sure that sensitive information won't leave the building.

A, Web server
B, FTP server
C, POP server
D, Proxy server ​

Answers

Answer: PROXY

Explanation:

The basic objective of the web server is to store, process and deliver web pages to the users.

FTP server is to allow users to upload and download files. An FTP server is a computer that has a file transfer protocol (FTP) address and is dedicated to receiving an FTP connection. FTP is a protocol used to transfer files via the internet between a server (sender) and a client (receiver)

pop provides access via an Internet Protocol (IP) network for a user client application to a mailbox (maildrop) maintained on a mail server

proxy server is a system that isolates internal clients from the servers by downloading and storing files on behalf of the clients. it intercepts requests for web-based or other resources that come from

Write a program that accepts inputs, outputs them and exits correctly when - 1
is pressed

Answers

Answer:

Explanation:

The following program is written in Python. It simply creates an endless loop that continously asks the user for an input. If the input is not -1 then it outputs the same input, otherwise it exists the program correctly. A test output can be seen in the attached image below.

while True:

   answer = input("Enter a value: ")  

   if answer != "-1":

       print(answer)

   else:

       break

You are the IT administrator for a small corporate network. The employee in Office 1 needs your assistance managing files and folders. Your task is to use the command prompt to complete the following:

a. Create the D:​\​utilities​\​recover directory. Use the md or mkdir command to create (make) a directory.
b. Delete the D:​\​software​\​arch98 directory and all of its files.
c. Use the rd command to delete (remove) a directory.
d. Use the /s switch to remove the directory and all of its contents at once.

Answers

Answer:

(a) mkdir /d D:\utilities\recover    

     or

    mkdir D:\utilities\recover    

(b) rd  /s  D:​\software​\arch98

Explanation:

(a) To make a new directory we use the md or mkdir command followed by the name of the directory as follows;

mkdir [name_of_directory]

The name of the directory could also be a relative or absolute path depending on the request.

In the task, the specified directory uses an absolute path given as D:​\​utilities​\​recover. This path is in a drive D. Therefore, if you are in another drive different than D, to run this command, it is a great idea to do that with the /d switch.

In summary:

i. if in drive D, to make a directory D:\utilities\recover, type the following command;

mkdir  D:\utilities\recover    

ii. if otherwise in a different drive, type the following command.

mkdir /d D:\utilities\recover

(b) To delete a directory, we use the rd or rmdir command. If the directory has contents that also need to be deleted, we use the switch /s alongside the rd or rmdir.

In the task given, the directory to be deleted is D:\software\arch98. This includes deleting all of its files too. To do this, type the following command;

rd /s D:\software\arch98

_ is a term used for license like those issues by creative commons license as an alternative to copyright

Answers

, . , .

Explanation:

'

how to make an app according to peoples will

Answers

Answer:

Follow these steps to create your own app:

1)Choose your app name.

2)Select a color scheme.

3)Customize your app design.

4)Choose the right test device.

5)Install the app on your device.

6)Add the features you want (Key Section)

7)Test, test, and test before the launch.

8)Publish your app.

Explanation:

(!!_!!)

Assign sum_extra with the total extra credit received given list test_grades. Iterate through the list with for grade in test_grades:. The code uses the Python split() method to split a string at each space into a list of string values and the map() function to convert each string value to an integer. Full credit is 100, so anything over 100 is extra credit.Sample output for the given program with input: '101 83 107 90'Sum extra: 8(because 1 + 0 + 7 + 0 is 8)user_input = input()test_grades = list(map(int, user_input.split())) # test_grades is an integer list of test scoressum_extra = 0 # Initialize 0 before your loop''' Your solution goes here '''print('Sum extra:', sum_extra)

Answers

Answer:

Replace ''' Your solution goes here '''

With

for i in test_grades:

   if i > 100:

       sum_extra+=i - 100

Explanation:

This iterates through the list

for i in test_grades:

This checks for list elements greater than 100

   if i > 100:

The extra digits (above 100) are then added together

       sum_extra+=i - 100

Other Questions
Consider the following equation. -2x + 6 =[-2/3] + 5 What are 2 examples of RHYME in the poem? g Calculate the final speed of a solid cylinder that rolls down a 5.00-m-high incline. The cylinder starts from rest, has a mass of 0.750 kg, and has a radius of 4.00 cm. Will Mark Brainlest Help pls hey! please help with this!!! Write all the 12 answer of measurements. If you cant do it and you think its a lot you dont have to! okay but I need this done asap! thank you so much have a amazing day!!! :) *spam? May b!* Which statement about the assassination of Martin Luther King is true?O A. He was killed by Black Panthers.O B. He was killed while marching in Chicago.O C. He was killed in a riot.O D. He was killed while trying to organize poor workers. Decide if the following sentence is grammatically CORRECT or INCORRECT.Nosotros cantarn en el coro.CorrectIncorrect What is the MEDIAN or Q2 of the data set: 24, 25, 29, 30, 31, 31, 32, 34, 34? Solve for y.3= y+7 divided by 3 Y= i need help please help Can somone help me solve this Find the product of 6*12. A.362. B.62. C.56. D.418. x163mnfind the value of x Sound travels slowest through gases _____________________. Group of answer choices because the molecules of gas are close together because gases are air because the molecules of gas are far apart because gases have the lowest temperature WILL GIVE BRAINLIEST two dice are rolled write the sample space and number of sample points also write events and number of sample points in the event according to the given condition sum of the digits of upper faces is a prime number , sum of the digits on the upper face is a multiple of 5 , sum of the digits on the upper face is 25 and digit on the upper face at the first die is less then then the digit on the second die Anyone know the answer to this? 2x^2 + 3x - 12 when x = 5 help pls Which of the following best describes what would have to change totransform a direct democracy into a parliamentary democracy?A. An individual would have to take direct control of the government.B. Executive leaders would have to be chosen from the legislativebranch.C. An elite group would have to take control of the government.D. An assembly of all citizens would have to take control from anelected group What is similar about the primary structure of actin and keratin?