Debugging (java) | Computer Science homework help

Overview

Many Java programs that you create will receive and process user input. In order to ensure that user input is accurate, you will need to use input validation and exception handling. For example, if you ask for a zip code, you want to ensure the user inputs a five-digit number. In this activity, you are given “buggy” code for a paint program that calculates the number of cans of paint required to paint a wall, given the wall’s height and width. You will need to debug the code and improve it by adding code to validate user input and handle exceptions.

Prompt

For this assignment, you will complete the paint program by debugging the original code and adding code that validates user input and handles exceptions. Use the Uploading Files to Eclipse and the Downloading Files From Eclipse tutorials to help you with this project.

  • Debugging
    • Open the Virtual Lab by clicking on the link in the Virtual Lab Access module. Then open your IDE. Upload the Paint1.zip folder and review the code for the Paint1.java file.
    • Find and fix the three errors in the given code.
    • Use the input values below to test your program. If you found and fixed all errors, your output should exactly match what is below.
      TIP: When you run your program in Eclipse, it will prompt you to enter input in the Console window. If you cannot find this window, go to Window, then Show View, then Console.

Input value table with the numerals 30 and 25

Output value table with the wall area as 750.0 square feet and the paint needed as 2.142857142857143 gallons

  • Input Validation and Exception Handling
    • Review the code, looking for the two code blocks where user input is required.
    • Implement a do-while loop in both blocks of code to ensure that input is valid and any exceptions are handled.
      TIP: Consider using a try-catch block for exception handling, but it is not required.
    • Use the two sample invalid inputs below to test your program. Your program should respond to each by prompting the user to enter valid input. This should continue to loop until valid input is received.

A table with two columns titled Input 1 and Input 2. The items under Input 1 are the spelled-out number thirty and the numeral 25. The items under Input 2 are the numerals 30 and 0.

THINK: Why is 0 invalid input for this problem? What is the user being asked to input?

Guidelines for Submission

Attach your completed Paint1.java file to the assignment submission page.

How do you place an order?

It takes a few steps to place an order with Us:

  • The first step is to place your order. You will need to provide us with some basic information about your project.
  • Once you have placed your order, you will be taken to our secure payment page.
  • Once we receive your order, we will carefully review it and match you with a writer who has the skills and experience.
  • Stay in contact with the writer and discuss vital details of research.
  • Your completed proposal will be delivered via email within the specified deadline.

You are secure when using our service

It's critical for each client to feel secure. As a result, we at Research Proposal Writing take precautions to secure your data.

Financial security You may securely pay for your purchase using a variety of secure payment methods.
Personal security The personal information of our clients is secure. Nobody else will have access to it.
Academic security We use a specialized program to check every completed paper to ensure that we deliver no-plagiarism samples.
Web security This website is safe from unauthorized breaches. We maintain our privacy management in line with the latest laws and regulations.

You can get help placing your order. If you have any questions about our services, please contact us. Our support staff is accessible 24 hours a day, 7 days a week.

If you're still looking for a way to improve your grades and hire expert writers, we've got you covered. Place an order on our website, and we'll help you with any paperwork you want. We will exceed your expectations.

Order now Get a quote