The problem

An electronics company sells circuit boards at a 40 percent profit, If you know the retail price of a circuit board, you can calculate its profit with the following formula:

Profit = Retail price x 0.4

Write a program that asks the user for the retail price of a circuit board calculates the amount of profit earned for that product, and displays the result on the screen.

Breaking it down

// profit as a percentage constantfinalstaticdoublePROFIT_AS_PERCENT=0.4;publicstaticvoidmain(String[]args){// Create a Scanner object for keyboard input.Scannerkeyboard=newScanner(System.in);// Get the number of years.System.out.print("Enter the circuit board's retail price: ");doubleretailPrice=keyboard.nextDouble();// Call method to calculate profit.doubleprofit=calculateProfit(retailPrice);// Display the amount of profit.System.out.println("Amount of profit: $"+profit);// close keyboardkeyboard.close();}/**
* Method will return the profit based on the
* retail price and PROFIT_AS_PERCENT constant.
*
* @param retailPrice
* @return number representing profit
*/publicstaticdoublecalculateProfit(doubleretailPrice){returnretailPrice*PROFIT_AS_PERCENT;}