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?

Recommended Answers

All 8 Replies

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.

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 $ ?

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.

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

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

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

or something similar ?

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.

and the code that creates nf is...?

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.