JAVA
Write a program that repeatedly reads in integers until a negative integer is read. The program also keeps track of the largest integer that has been read so far and outputs the largest integer at the end.

Ex: If the input is:
2 77 17 4 -1

the output is:
77
Assume a user will enter at least one non-negative integer.

Answers

Answer 1

The program is an illustration of loops

What are loops?

Loops are program statements that are used to execute repeated statements

The java program

The program, written in Java where comments are used to explain each line is as follows:

import java.util.*;

public class Main{

public static void main(String[] args) {

 Scanner input = new Scanner(System.in);

 int num;

//Get input from the user

 num = input.nextInt();

//Initialize the largest to the first input

 int maxn = num;

//This loop is repeated until a negative input is recorded

 while (num >=0){

//If the current input is greater than the previous largest

     if (num>maxn){

//Set largest to the current input

         maxn = num;      }

//Get another input from the user

     num = input.nextInt();

 }

//Print the largest

 System.out.print("Largest: "+maxn);

}

}

Read more about loops at:

https://brainly.com/question/14284157


Related Questions

please helppppppppppp

Answers

Answer:

x=√-5

Step-by-step explanation:

8-3x=√(4x^2+20)+8

-8                          -8

-3x^2=√(4x^2+20)^2

-3x^2=4x^2+20

-4x^2=20

divide both sides by -4

x^2=-5

√(x^2)=√-5

x=√-5

How do i figure out the degrees?

Answers

Answer:

  41°

Step-by-step explanation:

This problem involving the Law of Cosines has been mostly worked for you. The value of the cosine is the solution to the remaining one-step linear equation. The inverse cosine function (cos⁻¹ or arccos) is used to find the angle from the value of the cosine.

  -1125 = -1500·cos(A)

  cos(A) = -1125/-1500 = 3/4 . . . . . divide by -1500 (this is the one step)

  A = arccos(3/4) ≈ 41.4096°

The angle formed by the lines to the lampposts is about 41°.

__

Additional comment

If you find the angle using the ACOS( ) function of a spreadsheet, you will always get the result in radians. Most calculators offer the choice of units for angles, so be sure you set the mode appropriately.

In the calculator screenshot, there is a decimal point in the fraction to force the angle result to be displayed as a numerical value. Otherwise, this calculator shows cos⁻¹(3/4), which isn't terribly helpful.

Which polynomial is prime? x4 3x2 – x2 – 3 x4 – 3x2 – x2 3 3x2 x – 6x – 2 3x2 x – 6x 3.

Answers

The polynomial [tex]3x^2+x-6x+3[/tex] is a prime polynomial because it is not reducible or does not have factors.

Given polynomials are:

[tex]1)x^4+3x^2-x^2-3\\\\2)x^4-3x^2-x^2+3\\\\3)3x^2+x-6x-2\\\\4)3x^2+x-6x+3[/tex]

What are prime polynomials?

A polynomial not having more than one factor is called a prime polynomial.

Factors of the first polynomial are [tex](x^2-1),(x^2+3)[/tex]

Factors of the second polynomial are [tex](x^2-1),(x^2-3)[/tex]

Factors of the third polynomial are [tex](x-2) (3x+1)[/tex]

There are no factors of the fourth polynomial so this is a prime polynomial.

Therefore, the polynomial [tex]3x^2+x-6x+3[/tex] is a prime polynomial.

To get more about the polynomial visit:

https://brainly.com/question/2833285

The sum of three consecutive odd integers is 17 less than four times the smallest integer. Find the integers.

Please help, thank you!

Answers

Answer:

23, 25, 27

Step-by-step explanation:

n + (n+2) + (n+4) = 4n - 17

3n + 6 = 4n - 17

3n - 4n = -17 - 6

-n = -23

n = 23

therefore,

23, 25, 27 are the 3 consecutive odd integers

4s^3 when s=2


plsss help

Answers

Answer:

32

Step-by-step explanation:

=> 4s[tex]{}^{3} [/tex]

=> 4(2)[tex]{}^{3} [/tex]

=> 4(2×2×2)

=> 4(8)

=> 32

The temperature outside changed from 94°F to 46°F over a period of eight days. If the temperature changed by the same amount each day, what was the daily temperature change?

Answers

Answer:

6°F

Step-by-step explanation:

First, subtract 46 from 94 (94-46) and you will get 48.

Then, divide 48÷8 (because the time period is 8 days) and you will get 6.

Therefore, the daily temperature change is 6°F.

WHAT IS THE MEAN MEDIAN MODE?

Answers

Answer:

the mean is the average of a set of data the mode is the most frequent number that occurs in a set of data, and the median is the number in the middle of the set of data

Step-by-step explanation:

I have a test tomorrow! I am trying to study. I have no clue what the difference between scale and scale factor is! How do you find them? I have to know in 20 min. Please HELP!!!

Answers

Answer:

they are similar

Step-by-step explanation:

a scale is a normal number scale while a scale factor is a scale but instead of normal numbers it uses factors

Let's see

Scale usually denotes unit rate or a numerical value change mentioned above graphs

1in=3ft.1cm=1m

Scale factor is same but it uses factors .

like

1/32/5

Kevin plants a total of 72 flowers in equal rows. He plants 6 rows of yellow flowers and 2 rows of red flowers. How many flowers are in each row.

Answers

Answer:

72 +6+2 equal80

Step-by-step explanation:

have to pluse all

Solve for X (simplify your answer)​

Answers

Answer:

x is given as -1.5. Substitute to confirm

5x+3=x+11

x=?

(step by step, I am very not smart)

Answers

Answer:

x=2

Step-by-step explanation:

5x+3=x+11

5(2)+3=2+11

10+3 = 2+11

13=13

Therefore, x=2

(basically you just plug in random numbers and see if it gets you the same answer on both sides)

Hope this helps!!

What are the values of the variables in the triangle below?

Answers

Answer:

D) x=9 ; y=3√(3)

Step-by-step explanation:

[tex]Sin(30)=\cfrac{y}{6\sqrt{3} }[/tex]

[tex]\cfrac{18y}{6\sqrt{3}}=18\sin \left(30^{\circ \:}\right)[/tex]

[tex]\sqrt{3}y=9[/tex]

[tex]\cfrac{\sqrt{3}y}{\sqrt{3}}=\cfrac{9}{\sqrt{3}}[/tex]

[tex]y=3\sqrt{3}[/tex]

~

[tex]Cos(30)=\cfrac{x}{6\sqrt{3} }[/tex]

[tex]\cfrac{18x}{6\sqrt{3}}=18\cos \left(30^{\circ \:}\right)[/tex]

[tex]\sqrt{3}x=9\sqrt{3}[/tex]

[tex]\cfrac{\sqrt{3}x}{\sqrt{3}}=\cfrac{9\sqrt{3}}{\sqrt{3}}[/tex]

[tex]x=9[/tex]

Therefore, x=9 and y=3√(3)

~

A number cube is rolled and a coin is flipped. What is the probability that a number greater than 2 is rolled and the coin lands on heads?

Answers

Answer:

1/3

Step-by-step explanation:

The probability that a number greater than 2 is rolled is 4/6 {2, 3, 4 and 6} The probability that the coin lands on heads is 1/2

You can multiply 1/2 and 4/6 to find out the total number of possible outcomes: 1/2 × 4/6 = 4/12. This can be simplified to 1/3.

Hope this helps!

What is the answer ?5(y+2/5)=-13

Answers

Answer:

y=-3

Step-by-step explanation:

5(y+2/5)=-13

5y+2=-13

5y=-15

y=-3

the distance covered by a spider is 5 km in 6 hours. What is its speed?

Answers

Answer:

0.83km/h

Step-by-step explanation:

v (velocity/speed) = d (distance)/t (time)

v = 5km/6h

v = 0.83km/h

Which is the estimate of 398 x 1.9?

Answers

Answer:

800

Step-by-step explanation:

When we say estimate, we must estimate the 2 numbers to their closest answer:

398- 400 when rounded to the nearest 100

1.9- 2 when rounded to the nearest whole number

So we get the estimate equation as: 400×2= 800

Solution:

We know that:

[tex]\tex\text{398 can be rounded to 400, as 398 is close to 400.}[/tex][tex]\tex\text{1.9 can be rounded to 2, as 1.9 is close to 2.}[/tex]

This means that:

[tex]398 \times 1.9[/tex] ≈ [tex]400 \times 2[/tex]

Simplifying "400 x 2"

[tex]400 \times 2[/tex] [tex]= 800[/tex]

Thus, the estimate of 398 x 1.9 is about 800.

Please answer this friends ?

Answers

Answer: Rs. 6075

40500×(15/100)= 6075

Step-by-step explanation:

Nicholas has a collection of books. He has 115 fantasy and science fiction books. These books are 46℅ of his collection. How many books does he have in his collection?

-- pls explain!!!

Answers

Answer:

46% of 115 gives 52.9 because it is the total of books that is not given

Tyshaun buys music online. Each song costs $2 plus a $5 fee for using the artist’s site. He has no more than $40 to spend. Which inequality shows the number of songs, s, Tyshaun can purchase?

Answers

Answer:

I dont see options, but the answer should be: X(2+5)≤40

Step-by-step explanation:

Find the slope of the line that passes through the following points: (1,0)
and (6,-3). (Show your work.)

Answers

Answer

-3/5

Step-by-step explanation:

to find this you have to use the equation y1 - y2 / x1 - x2

so first write -3 - 0 (or 0 - - 3) over 6 - 1

it looks like -3/5

math answer? can someone help?

Answers

Answer:

I think the answer is "A"

is 14.624777961 rational or irrational

Answers

Step-by-step explanation:

Rational number because it's terminating

Naelly is taking a class trip to Washington DC. The cost of the trip is $459. 60. Naelly paid an initial deposit of $150, and must make the remainder of the payments in 12 equal monthly payments. What is the amount of each monthly payment in dollars and cents?

Answers

459.6 - 150 = 309.6

309.6 / 12 = $25.80 a month for 12 months

I need HELP!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Answers

Step-by-step explanation:

no calculator or Excel sheet ?

(4×(4 + 3)) - 3 = (4×7) - 3 = 28 - 3 = 25

((7 - 5) ÷ 1/2) × 2 = (2 ÷ 1/2) × 2 = (2 × 2) × 2 = 4×2 = 8

(5.4 + 3) × (6 - 2) = 8.4 × 4 = 33.6

(9 ÷ 3 + 6) × 3 = (3 + 6) × 3 = 9×3 = 27

(4 + 3.2) × ((9 - 2) + 2.5) = 7.2 × (7 + 2.5) = 7.2 × 9.5 = 68.4

remember 2 things :

1. first priority for the sequence of operations is defined by brackets. second priority are multiplication and division (both are on the same level, and you can do them either way). and only third priority is addition and subtraction (they come last, and if you keep the "-" signs with the numbers, you can do them also in any sequence among each other : a - b = -b + a).

2. when you divide by a fraction, then this is the same as multiplying with the upside-down version of that fraction.

a / 1/b = a × b/1 = a × b

8. Evie buys colored
Pencils for $3.79
markers for $5.80, and
paper for $2,57, She
Pays 6.25% Sales tax.
How much does she
spend total?

Answers

12.16+0.76=12.92
Pay 12.92 in total

A semicircle is drawn onto one of the shorter sides of a rectangle. The shorter side of the rectangle measures 4 centimeters. The area of the figure is 41. 4 square centimeters. What is the length of the longer side of the rectangle?Use 3. 14 for π. Enter your answer as decimal in the box

Answers

The length of the longer side of the rectangle is 8.78cm

Area of composite figure

The formula for calculating the area of a rectangle is expressed as:

A = lw

For a semicircle;

A = πr²/2

r is the radius

Area of the figure = lw + πr²/2

Substitute the given paramters

41.4 = 4w +  π(2)²/2

41.4 = 4w + 6.28
4w = 41.4 - 6.28

4w = 35.12

w = 35.12/4

w=  8.78 cm

Hence the length of the longer side of the rectangle is 8.78cm

Learn more on area of composite figure here: https://brainly.com/question/21135654

Downtown it snowed 1/10 of an inch inthe morning and 3/10 of an inch in the evening. How much more snow fell in the evening than in the morning?

Answers

Answer:

2/10

Step-by-step explanation:

Keep the bases the same so we are dealing with 3 - 1 so we get 2. 2/10 of snow falls in the evening than in the morning.

Have an amazing day!

PLEASE RATE!!!

Please help me do to night

Answers

Answer:

1.) -4x+30y 2.) distributive property 3.) -4x+30y, (-0.4(3)+3(2)), 10(-1,2)+10(6), -12+60, =48

Step-by-step explanation:

10(-0.4x+3y)= 10(-0.4x)+10(3y)= -4x+30y

10(-0.4(3)+3(2))

10(-0.4(3))+10(3(2))

10(-1.2)+10(6)

-12+60

= 48

Write an expression to represent the perimeter of Melissa’s garden in terms of x.

Type the correct answer in each box. Use numerals instead of words.

Answers

As no diagrams attached provided the formulas which can helps you to solve by yourself

Square--4(side)Rectangle--2(Length+Breadth)Triangle--(Sum of 3 sides)Any quadrilateral--(sum of 4 sides)

The expression to represent the perimeter of Melissa’s garden in terms of x is P = 8x + 14

Perimeter of a rectangle

The formula for calculating the perimeter of a rectangle is given as

P = 2(x+ y)

where;

x = 3x + 2

y = x + 5

Substitute

P = 2(3x + 2 + x + 5)

P = 2(4x + 7)
P = 8x + 14

Hence the expression to represent the perimeter of Melissa’s garden in terms of x is P = 8x + 14

Learn more on perimeter of rectangle here: https://brainly.com/question/19819849

#SPJ6

For a new hobby, Leo purchases a vintage camera for $475. Leo pays $5.99 for each roll he gets developed. Calculate how much Leo’s new hobby is costing him based on the number of film rolls he needs to develop.

Answers

Answer:

A = 5.99x + 475

Step-by-step explanation:

In the equation I wrote, x is equal to the number of film rolls he needs to develop. You just put that number in for x and solve the equation. That will give you the amount of money Leo spends on his new hobby.

Other Questions
Let f(x) = 22 + 3.0 +2What is the average rate of change of f(x) from 3 to 6? hey guys me and my favv fell off a couple of weeks ago and i wrote a paragraph for him should i send it???? what is the measure of Here is a rectangle ABCD. A B 20 cm D 30 cm The length of the rectangle is increased by 10%. The width of the rectangle is increased by 5%. Find the percentage increase in the perimeter of the rectangle. Female sea turtles prefer to lay their eggs on dark, sandy beaches. Once the eggs hatch, the turtle young use the light of the moon to guide them to the ocean. They must enter the ocean quickly in order to find food and avoid the many predators that can locate them on the beach.As more homes and businesses are built along the coastline, the sea turtles become more threatened. Which of the following types of pollutions from homes and businesses would have the greatest impact on sea turtles finding their way to the ocean? A. noise B. light C. air D. wateranswerB. light Calculate the ideal mechanical advantage of a lever in which effort arm is 60 cm and load the arm is 4 cm Please help people!!! :D How to make 2 numbers add up to 120 but one of the numbers is 25 more than the other. how do plants get energy Jon Deposits $7,050 into an account paying 5% annual interest compounded quarterly and Sara deposits $4,867 into an account paying 10% annual interest compounded daily who will have more money after 1 year? How much more will that person have? Show and explain all work. Please help!!! Ill mark brainly Institutionalized discrimination is basically How are you feeling now? which economic idea did adam smith promote in the wealth of the nations Please help me Asap thanks if you do! Diseases causing toxins are produced byA. VirusesB. ProtistsC. BacteriaD. Fungi A student wants to create a 2:1 scale drawing of the classroom. Is this an appropriate scale to use? Why or why not? Nathan said, "__________ pen is new."a.yourb.myc.hisd.Her Na + H2 NaCl balanced equation The line when all at once I saw a crowd a host of golden daffodils is an example of