0

Hello,

 I am having trouble with how my program displays the items with a $ sign. I do not want a dollar sign and I ma not sure how it got there as I did not put one in. Is there a way to get rid of the $ sign without posting my code?
5
Contributors
8
Replies
34
Views
2 Years
Discussion Span
Last Post by mxwarning
0

if u r talking about "money" representation usually is because ur regional configuration are UnitedStates or any that use money signs DOLLAR! ... is an property of ur OS.

Edited by zolymo: added OS reason

0

zolymo: for Java, that makes little sense. all mxwarning would have to do, to print it without a currency symbol, is to print it as String.

mxwarning: what code of your prints $ ?

0

Hello stultuske,

 The output is this:

Welcome to the inventory program
Enter the item number:
1234
Enter the product name:
Sauce
Enter the product price: 1.59
Enter the total products in stock: 12
Item number is 1234
The product name is Sauce
The number of products in stock are: $12.00
The price of each product is: $1.59
The inventory value is: $19.08
BUILD SUCCESSFUL (total time: 14 seconds)

I do not want the $ sign where the products in stock are. And if I declare productInStock as a string how do I get the totalInventoryValue which = productInStock * productPrice. I did try it and it gave the error can't go from string to double.

0

Isn't it being printed just as a static string value in the print method?
perhaps if you show some code ..

Edited by Slavi

0

I meant: your code.
are you printing it like:

System.out.println("The inventory value is: $" + value);

or something similar ?

0

Here is the code

System.out.print(" The inventory value is: ");
System.out.println(nf.format(totalInventoryValue));

As I said I did not add a $ sign, so I am not sure why it is there.

0

Thank you all I figured it out. I had the nf. where it should not have been. Thank all.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.