java project and need guidance to help me learn.
Overview
In this assignment, you will revisit the Paint program from Module Six. Your original program calculated the amount of paint needed, but depending on the height and width, that value could be a long decimal. Your program will better suit the needs of the user if it can calculate the number of cans needed as an integer value. For example, given that 1 gallon = 1 can of paint, we might expect the Paint program from Module Six to output:
Paint needed: 2.142857142857143 gallons
Cans needed: 3.0 can(s)
You might at first think that you could just cast the gallonsPaintNeeded variable from a double to an integer type. However, that would merely truncate the decimal portion of the value, resulting in an underestimate of the number of cans needed. Rounding would also result in an underestimate. So, the computational problem you are faced with is to calculate the number of cans and then round up to the nearest whole number.
Instead of writing the code to do this from scratch, you will search through the Java API documentation to find an existing method that can take a double and round it up to the nearest whole number. This assignment will help you become more familiar with navigating the Java API documentation, a useful skill for Java programmers. With over 4,000 Java classes, being able to navigate through Java documentation will help make your programming efforts more efficient.
Prompt
For this assignment, you will complete the Paint program by adding code that calculates the number of cans of paint needed to paint a wall, given its height and width. The following table shows four different test cases with sample input and output values that your completed program will need to handle.Input: Input: Input: Input:
30
25 7.5
22.8 20
35 25.4
21.6
Output: Output: Output: Output:
Paint needed: 2.142857142857143 gallons
Cans needed: 3.0 can(s) Paint needed: 0.48857142857142855 gallons
Cans needed: 1.0 can(s) Paint needed: 2.0 gallons
Cans needed: 2.0 can(s) Paint needed: 1.5675428571428571 gallons
Cans needed: 2.0 can(s)
First, you will select a method that appropriately handles all of the included test cases by consulting the official Java documentation for the Math class. Use the following tips to help you navigate the documentation:
Scroll to the Method Summary section of the Math class and review the methods and their descriptions. Look for a method that will help you round a value up to the nearest integer.
If a method looks promising, click on its name to see a more detailed description. Pay special attention to the argument(s) and the data type of the return value.
Based on your review, select one or more methods from the Math class to use in your program.
Open the Virtual Lab by clicking on the link in the Virtual Lab Access module. Then open your IDE and upload the Paint2.zip folder. Review the code for the Paint2.java class, looking for the comment //Complete this code block. Here, you will implement your selected method so that your program meets the required functionality. The program should do the following:
Calculate the number of paint cans needed to paint the wall.
Round up to the nearest integer. Use the test cases to check your work.
Output the number of cans needed for the user.
TIP: When implementing your selected method from the Math class, use the syntax Math.methodname(). For example, if you decided to use the absolute value method, you would write the following code: Math.abs().
Guidelines for Submission
Submit your completed Paint2.java file. Use the Downloading Files from Eclipse Tutorial PDF to help you download the file for your submission.
Requirements:
Downloading Files From Eclipse This tutorial will guide you through the steps necessary to download files from Eclipse and submit them to your instructor via Brightspace. 1. Open your project in Eclipse. Be sure your browser window is in full-screen mode and ensure the Package Explorer is visible. a) If the Package Explorer is not visible, navigate to the Window tab on the menu bar at the top of the screen. b) From the drop-down menu, click Show View. Then click the Project Explorer option from the second drop-down menu.
2. With your project open in Eclipse, use the Package Explorer tab in the upper left-hand corner to expose your project files. a) First, click on your project name. In this example, the project name is project1. b) Next, click on the src folder. Then, click the default Package folder. In this example, the default Package is called projectPackage. 3. Right-click your JAVA file and select the Properties option. Note the Location of your file. In this example, the location reads: U:\project1\src\projectPackage\Example.java. 4. Close the Properties window.
5. Select the download icon from the Virtual Lab (Apporto) toolbar. 6. Navigate to your files based on the location you identified in Step 3. In this example, the file is located in Cloud PC, then Documents, then project 1, then src, and then projectPackage. 7. Select the file and then click the Download button. This will download the selected file to your computer. You may only select one file for download at a time. Repeat this step for any additional files that are needed. 8. Take note of where your downloaded files are on your local computer. You will have access to the Downloads menu bar in your browser window. You can also check the Downloads folder on your local computer. 9. Log in to your classroom in Brightspace and navigate to your assignment. On the assignment page, click the Add a File button.
10. From the Add a File window, click the Upload icon and navigate to the location of your files on your local computer. a) Alternatively, you can drag and drop your files in the Drop files here area. b) When all files have been selected, click the Add button at the bottom left of the screen. 11. If you are instructed to add text to the Comments section, you may do so at this time. Finally, you are ready to click the Submit button to submit your assignment.
We are a professional custom writing website. If you have searched a question and bumped into our website just know you are in the right place to get help in your coursework.
Yes. We have posted over our previous orders to display our experience. Since we have done this question before, we can also do it for you. To make sure we do it perfectly, please fill our Order Form. Filling the order form correctly will assist our team in referencing, specifications and future communication.
1. Click on the “Place order tab at the top menu or “Order Now” icon at the bottom and a new page will appear with an order form to be filled.
2. Fill in your paper’s requirements in the "PAPER INFORMATION" section and click “PRICE CALCULATION” at the bottom to calculate your order price.
3. Fill in your paper’s academic level, deadline and the required number of pages from the drop-down menus.
4. Click “FINAL STEP” to enter your registration details and get an account with us for record keeping and then, click on “PROCEED TO CHECKOUT” at the bottom of the page.
5. From there, the payment sections will show, follow the guided payment process and your order will be available for our writing team to work on it.
Need this assignment or any other paper?
Click here and claim 25% off
Discount code SAVE25