InterviewSolution
Saved Bookmarks
| 1. |
Write Java code that takes the cost of a pencil from jTextField1 and number of pencil from jTextField2 and calculate the total amount as cost*number to be displayed in jTextField3 and 20% of the service tax out of total amount in jTextField4. |
|
Answer» double cost = Double.parseDouble(jTextField1.getText()); int n = Integer.parseInt(jTextField2.getText()); double amount = cost * n; jTextField3.setText(Double.toString(amount)); jTextField4.setText(Double.toString(amount * 0.20)); |
|