Question: debug this Java code This program demonstrates an array of String and integer objects. It should print out the days and the number of speeding

 debug this Java code 

 


This program demonstrates an array of String and integer objects. It should

This program demonstrates an array of String and integer objects. It should print out the days and the number of speeding tickets given in the last 4 days of April on Spriggs Road. It should print out the day with the least number of speeding tickets. You must use the findLowest () method within your solution to find the lowest day. This is what should display when the program runs as it should April 27 had 12 tickets. April 28 had 10 tickets. April 29 had 15 tickets. April 30 had 17 tickets. Lowest Day has 10 tickets. public class SpeedingTicketsDebug { public static void main(String[] args) { String[] days = { "April 27", "April 28", "April 29", "April 30"}; int[] tickets = {12, 10, 15, 1,7}; int lowest = 0.0; String lowest Day = for (int index = 0; index < tickets. length; index++) { System.out.printf( "%s had %, d tickets. ", days [index], tickets [index]); lowest find Lowest (tickets); System.out.printf("Lowest Day has %, d tickets. ", lowest); //end of main public static double find Lowest(String[] myDays, int[] myTickets) { my Lowest = myDays [0]; for (int index = 1; index < myTickets.length index++) { if (myTickets [index] > lowest) { my Lowest = myTickets [index]; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Heres the corrected Java code with explanations for the changes public class SpeedingTicketsDebug pu... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!