Question: This program converts a cost read for a particular product into dollars and cents. Ask the user to type in both a product and how

 This program converts a cost read for a particular product into

This program converts a cost read for a particular product into dollars and cents. Ask the user to type in both a product and how much it costs in decimal numbers. Then print the price written as dollars and cents. I recommend you store the cost as a String to take advantage of the String methods length() and charAt(). For full credit, you must use exactly one if statement and one else statement (the use of two if statements and the use of else if are both disallowed). Note that you can assume the user will always enter a price between $10.00 and $999.99 Your program should work identically to the examples below: mple Output: Enter the name of a product: bubble gum Enter the price: $2.95 bubble gum cost is 2 dollars and 95 cents

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!