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
ipn [44]
3 years ago
7

An array of integers named parkingTickets has been declared and initialized to the number of parking tickets given out by the ci

ty police each day since the beginning of the current year. (Thus, the first element of the array contains the number of tickets given on January 1; the last element contains the number of tickets given today.) A variable named mostTickets has been declared, along with a variable k. Without using any additional variables, write some code that results in mostTickets containing the largest value found in parkingTickets.
Computers and Technology
1 answer:
Sedaia [141]3 years ago
6 0

Answer:

Following code will store the largest value in array parkingTickets in the variable mostTickets

mostTickets = parkingTickets[0];

for(int k = 0; k<parkingTickets.length; k++)

{

if(parkingTickets[i]>mostTickets)

{

 mostTickets = parkingTickets[i];

}

}

Explanation:

In the above code segment, initially the number of tickets at first index is assumed as largest value of tickets in array.

Then using a for loop each value in the array parkingTickets is compared with the current mostTickets value.

If the compared value in parkingTickets array is larger than the current mostTickets value. Then that value is assigned to mostTickets.

This process is repeated for all elements in array.

Thus after looping through each element of array the largest value in array will get stored in mostTickets variable.  

You might be interested in
Which of the following statements is TRUE?
Leya [2.2K]

Answer:

B

Explanation:

im pretty sure thats the answer

5 0
3 years ago
Giải thích mục đích của các thao tác open() và close().
kicyunya [14]

Answer:

Which lan is it

8 0
2 years ago
Read 2 more answers
Blender is used by which video game team member?
prohojiy [21]

Answer:

The 2nd one

Explanation:

6 0
3 years ago
Alex has composed a layout with this Image for a magazine. Which rule of composition has Alex applied?
Genrish500 [490]

Answer:

Golden Ratio

Explanation:

7 0
3 years ago
Write a sub-program to display the acceleration of car. The program should ask initial velocity, final velocity, and time taken
LekaFEV [45]

Explanation:

If your asking the program in modular programming of Q-Basic & in sub procedure then here it is.

I hope it will help you..

<em>-</em><em> </em><em>Regards</em><em> </em><em>Rishab</em><em>.</em><em>.</em>

8 0
1 year ago
Other questions:
  • Given main(), define the Team class (in file Team.java). For class method getWinPercentage(), the formula is:teamWins / (teamWin
    15·1 answer
  • Identify requirements that should be considered when determining the locations and features of firewalls. What are some importan
    5·1 answer
  • When uninstalling software, it is best to delete the folder containing the software?
    11·1 answer
  • Please helpp!! I need it quickly!
    6·1 answer
  • Which protocol do e-mail programs use to identify the file types of attached files?
    7·1 answer
  • Idea citizen activation
    9·2 answers
  • ______ are used to store all the data in a database.
    7·1 answer
  • Which of the following is the BEST reason to use cash for making purchases? everfi
    15·1 answer
  • How are comments in a Java program treated by the compiler?
    14·2 answers
  • In java I need help on this specific code for this lab.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!