Question: Code in java Use JOptionPane to ask the user for the prices of items bought for lunch. The prices should be entered separated by commas.
Code in java
Use JOptionPane to ask the user for the prices of items bought for lunch. The prices should be entered separated by commas. (e.g. $6.99, $1.09, $1.99)
Read in the String and create a StringBuilder.
Remove the $ signs.
Create a String[] out of the prices entered.
Trim the white spaces around the numbers
Convert the Strings to numbers and add them all up
Display the total price to be paid
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
