debug this Java code This program demonstrates an array of String and integer objects. It should print
Fantastic news! We've Found the answer you've been seeking!
Question:
debug this Java code
Transcribed Image Text:
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. \n", days [index], tickets [index]); lowest find Lowest (tickets); System.out.printf("Lowest Day has %, d tickets.\n", 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]; } 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. \n", days [index], tickets [index]); lowest find Lowest (tickets); System.out.printf("Lowest Day has %, d tickets.\n", 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]; }
Expert Answer:
Answer rating: 100% (QA)
Heres the corrected Java code with explanations for the changes public class SpeedingTicketsDebug pu... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
Predictive text entry systems are familiar on touch screens and mobile phones. This question asks you to consider how the same principles might be used in a programming editor for creating Java code....
-
answer the question clearly You are building a flight-control system for which a convincing safety case must be made. Would you assign the tasks of safety requirements engineering, test case...
-
Craig Industries was in the business of manufacturing charcoal. Craig, the corporation's president, contracted in the name of the corporation to sell the company's plants to Husky Industries. Craig...
-
Accountants follow ethical guidelines in the conduct of their work. What are these standards of professional conduct designed to produce? Why is this goal important?
-
Assembly-Line Balancing. A product is assembled from three different parts. The parts are manufactured by two departments at different production rates as given in the following table: Determine the...
-
The following table lists values measured for 60 consecutive eruptions of the geyser Old Faithful in Yellowstone National Park. They are the duration of the eruption (x1), the duration of the dormant...
-
Josh is a judge employed by the county. He must purchase and maintain his judicial robes. The total cost of purchasing a new robe and dry cleaning for the current year is $750, which is not...
-
Deep Purple Industries has an EBIT of $12 million per year forecast in perpetuity. Deep Purple's cost of equity is 15% and its tax rate is 28%. If Deep Purple Industries borrows $30 million, what...
-
Sales Selling price per pair of skis Variable selling expense per pair of skis Variable administrative expense per pair of skis Total fixed selling expense Total fixed administrative expense...
-
Given the general knowledge and trends around 2018 regarding the increasing importance of non-financial metrics in decision-making, the FALSE statement from the AICPA 2018 survey is likely:...
-
Sarah needs 1 . 5 million for retirement in 4 0 years. She has a mutual fund that will earn 4 % anually. How much will sarah need to invest today?
-
5. (a) Prove that y(x) = e-1+x - 1 is a solution of the initial value problem y'(x) = x(1 + y)(1+x)1/2, y(0) = 0
-
one trillion bits is equivalent to ? A type of network media which every pair of cable is protected ? Why communication is important in computer network? Give at least one network device and give...
-
1. Using the data below, calculate a 3-period simple moving average for the relevant periods. Demand Time Period 1 2 3 4 5 6 7 8 9 10 400 450 480 520 540 530 490 460 450 400 Forecast 390 475 485 460...
-
please answer the case questions throughly CASE FOR ANALYSIS Bradford Chemicals Company's Bradford Chemicals manufactures high-quality plastics and resins for use in a variety of products, from lawn...
-
If the amplifier indicated by the box input impedance of oo, which of the following statements are true ? has an open loop gain as well as Feedback factor (\beta = 1/ R_1\) The feedback is voltage...
-
What safeguards does C++ provide to keep you from exceeding the limits of an integer type?
-
What feature of the output method definitions allows you to concatenate output?
-
What class methods does the compiler generate automatically if you dont provide them explicitly? Describe how these implicitly generated functions behave.
-
What is BI and why is it important in an organization?
-
Why would an organization satisfice instead of optimize when making a decision?
-
What is predictive analytics?
Study smarter with the SolutionInn App