91.8k views
0 votes
A shop specialising in household paint products has approached you (an application developer) for your services. They want you to develop an application they will use in their shop to estimate the amount of paint that customers would need to purchase when they supply the dimensions of their houses. To develop this application, you will work on the following assumptions: ⋅ A house is a three-dimensional structure (the dimensions are length, width, and height) ⋅ A tin of paint covers about 10 square meters of wall space. Create an application using Java that prompts the user for a rectangular room's length, width, and height. Pass these three parameters to a method that does the following: ⋅ Calculate the room's wall area and display it inside a label when a button is clicked. ⋅ Pass the calculated wall area to another method that calculates and returns the number of tins of paint needed. ⋅ Display the number of tins needed in a label. This must happen at the click of a button. ⋅ Compute the paint price given that a tin of paint costs R30 assuming that any fraction of paint is bought at the full price of a tin. The total cost of the paint should be displayed on a label when a button is clicked. ⋅ The system (application) should calculate and display the amount of value-added tax charged, and the total cost of the paint after value-added tax should be displayed. ⋅ Lastly, the application should capture the amount tendered to the cashier and calculate and display the change.

1 Answer

6 votes

Final answer:

The project entails developing a Java application that estimates the amount of paint needed for a room based on its dimensions. It will provide the wall area, the number of tins of paint required, the total cost including value-added tax, and the amount of change to be returned.

Step-by-step explanation:

Java Application for Paint Estimation

To develop a Java application for estimating the amount of paint needed for a room, one needs to calculate the area of walls after taking the room dimensions. Utilizing the given assumptions, the application will include an interface with fields for length, width, and height input, and buttons for calculations. A method will calculate the total wall area considering window deductions if necessary. The result, based on a coverage of 10 square meters per tin, will determine the number of tins of paint required, with each tin priced at R30. Furthermore, it will include value-added tax (VAT) calculations and display the final cost, capturing the amount paid and calculating the change returned to the customer.

For the user interface, one might choose to use JavaFX or Swing. The application logic will involve methods to calculate areas, number of paint tins, total cost, and the VAT. Since any fraction of a tin is sold at full price, the application would need to use a ceiling function to round up to the nearest whole tin when calculating the number of tins needed. Error handling should also be included to handle invalid inputs and avoid incorrect calculations.

User Homewrecker
by
8.0k points