Monetary value as double

I have to do a program which prompts for and reads a double value representing a monetary amount. It has to determine the fewest number of each bill and coin needed to represent that amount, starting with the highest (maximum size needed a ten dollar bill). So far, this is all I have for my code. But I am really having trouble on the calculation part I just don't know how to start. Thanks for your help.
import java.util.Scanner;
    public class Program_2_9
   //This program will prompt for and read a double value. Then determine
   //the fewest number of each bill and coin needed to represent that
   //amount, starting with the highest(10 dollar bill is the maximum size
   //needed).
       public static void main(String[] args)
      //Declaration section
         double pennies,nickels,dimes,quarters,dollar;
         int total;
         Scanner scan = new Scanner(System.in);
      //Read coins value as a double value
         System.out.println("Enter amount of dollars(double value): ");
         dollar= scan.nextDouble();
         System.out.println("Enter amount of quarters(double value): ");
         quarters= scan.nextDouble();
         System.out.println("Enter amount of dimes(double value): ");
         dimes= scan.nextDouble();
         System.out.println("Enter amount of nickels(double value): ");
         nickels = scan.nextDouble();
         System.out.println("Enter amount of pennies(double value): ");
         pennies = scan.nextDouble();
     

Here's some info on classpath:
Javapedia: Classpath
How Classes are Found
Setting the class path (Windows)
Setting the class path (Solaris/Linux)
Understanding the Java ClassLoader
java -cp .;<any other directories or jars> YourClassNameYou get a NoClassDefFoundError message because the JVM (Java Virtual Machine) can't find your class. The way to remedy this is to ensure that your class is included in the classpath. The example assumes that you are in the same directory as the class you're trying to run.
javac -classpath .;<any additional jar files or directories> YourClassName.javaYou get a "cannot resolve symbol" message because the compiler can't find your class. The way to remedy this is to ensure that your class is included in the classpath. The example assumes that you are in the same directory as the class you're trying to run.

Similar Messages

  • Converting hexadecimal value to double   Hlep needed!!!

    Is there a way that I can convert the following hexadecimal value into double:
    String s = "16#1234#";
    As converting this to long I am doing this
    if (s.startsWith("16#") && s.endsWith("#"))
    extractedValue = s.substring( 3, s.length()-1 );
    longValue = Long.parseLong( extractedValue, 16 );
    Is there any way I can do the same and change the above to double. If I use
    doubleValue = Double.parseDouble(s);
    gives me an error so I want to parse the above value and change it to double any tips of work arround.
    Thnaks

    double doubleValue;
    doubleValue = Integer.valueOf(s.substring( 3, s.length()-1 ), 16).intValue();
    this works because int is big enough to handle 4 hex digits (can handle 7 hex digits safely)
    then the conversion "widens" to double

  • Values are doubled in analyzer??? why???

    I have created this query:
    free characteristics: calendar day/sold to party/ material
    key figures:billed quantity/billing value
    when I run this query in analyzer I get the exact double values than the ones I should get. I mean in R3 the correct values that I check from another report there are halpf, which is the correct. In BW analyzer the values are doubled
    Why does this happen???
    I also have anotheer problem, I can get values up to 07/2008? the job probably has an error ever since and does not run automatically?? any ideas?? where should I look?(transactions)
    Thank you

    Hi,
    when I run this query in analyzer I get the exact double values than the ones I should get. I mean in R3 the correct values that I check from another report there are halpf, which is the correct. In BW analyzer the values are doubled
    Why does this happen???
    --> First check data in infocube, i think data loaded wrongly, hence double records. check for particular material or customer for a month.
    I also have anotheer problem, I can get values up to 07/2008? the job probably has an error ever since and does not run automatically?? any ideas?? where should I look?(transactions)
    --> Please check your other post
    Hope it Helps
    Srini

  • Value gets doubled in the cube when doing a data mart

    Hi,
    I am doing a data mart from one cube to another cube for different consolidation units and the value gets doubled for all the consolidation units except for one consolidation unit.there are no duplicate results in the cube.
    Can anyone tell me how i can debug this issue or what could be the reasons,This is very urgent.
    Thnaks and Regards,
    Subha

    In the Cube that is being loaded try seeing its content. While seeing its content give the restriction on the Request ID as that of the request which loaded the Cube.
    If you find the consolidation unit values doubled there, try seeing your update rule and transfer rule if the value is being changed anywhere.
    Then check the PSA.
    Hope that helps.
    Regards.

  • Reporting Level The Value will Double....

    Hi Friends,
                      IN BI 7.O I Build MultiProvider Based on DSO And CUBE.Here My DSO is Standard  and the same DSO  Fields are Mapped  in to CUBE also.Here My Query Also Standard Query Under DSO,But I copied to Multiprovider.When i execute the Query the Value will be Double.Please let me know the solution for this.
    Thanx & Regards,
    Raghavendra Bellam.

    Hi,
    As you are aware that a Multiprovider perform a union operation on data from all the objects underneath it.
    If your Query selection fullfil the criteria from the cube as well as DSO the key figure value would be double.
    One solution is to provide a variable/Filter for the infoprovider in the query to get result from only one of them.
    Hope this solves.
    Regards,
    Karan

  • Sorting and null for monetary values in a report

    All,
    I think this should be an easy one, and I've just missed something obvious.
    I have a standard report in APEX 3.2.1 that includes a column with a monetary amount in it. I want the column to show the UK Pound sign, be sortable, and show nulls where appropriate.
    The issue I have is I can't find a way to achieve all 3 in a satisfctory way. As I see it the options would be:
    1) In the SQL for the report, concat the pound sign to the column required, e.g. SELECT '£'||amount FROM....
    The issue is that this makes this field a CHAR field, so sorting would not sort in the same way as for a number field.
    2) Use the Number format FML999...etc. in the Column Attribute.
    The problem with this is that this is a multi-country database, and the default monetary unit is set to the US dollar.
    3) Use the HTML expression box in the Column attribute to display £#COL#
    This fulfills the pound sign and retaining the number format, but unfortunately a null value is displayed as a £ sign with no numbers. I can't think how to get it to leave that value in the report as completely blank.
    As I said, I'm sure I've missed soemthing obvious. If anyone can spot how to achieve this it'd be much appreciated.
    Regards,
    Jon.

    >
    2) Use the Number format FML999...etc. in the Column Attribute.
    The problem with this is that this is a multi-country database, and the default monetary unit is set to the US dollar.
    >
    The NLS currency symbol can be modified on the fly if you have some means of identifying user location/preference: {thread:id=990848} (ignore the last post)
    However, it probably doesn't make sense to do that&mdash;£100 &ne; $100 (at least I hope not!)&mdash;unless there's some kind of conversion occurring in the report? Is there a currency stored along with the amount?
    >
    3) Use the HTML expression box in the Column attribute to display £#COL#
    This fulfills the pound sign and retaining the number format, but unfortunately a null value is displayed as a £ sign with no numbers. I can't think how to get it to leave that value in the report as completely blank.
    >
    Use 2 columns, one for the amount, and one for the currency, with a switch to include or exclude the latter as necessary:
    select
              ename
            , comm amount
            , nvl2(comm, '£', null) currency
    from
              emp
    where
              job in ('SALESMAN', 'MANAGER')
    ENAME      AMOUNT                 CURRENCY                        
    ALLEN      300                    £                               
    WARD       500                    £                               
    JONES                                                             
    MARTIN     1400                   £                               
    BLAKE                                                             
    CLARK                                                             
    TURNER     0                      £                                Then use both columns in the Amount HTML Expression:
    #CURRENCY##AMOUNT#

  • How to convert value from exp. value to double/float???

    Hi all,
    I am fetching values from database, which is of type double / float.
    eg. values will be like -22,777,548 will be stored in database.
    NOw if i use
    float a= rs.getFloat(1);
    out.println("a="+a);
    I get output as a= -2.2777548E7
    I want to remove "E" from out put value and display as it was given in DB.
    How to solve this problem?
    Please Help!
    Regards
    Ashvini

    What do you mean - 'how does it work' ? All format classes (MessageFormat, DecimalFormat , SimpleDateFormat etc) are used to convert data from one form to other. Go through the java.text.* api. They work based on some pattern searches, pattern matches etc - dont know in detail :)
    As for the other things, thanks :)
    cheers,
    ram.

  • 0VALUE_LC values are doubled

    Hi All !
    Using business content installed the DSO 0CM_DS03, Update Rule 0CM_DS03 -> 2LIS_03_BF. But when loading the data the value of field 0VALUE_LC is getting double.
    Few notes :
    1) I have not written any code in Update Rule. It was installed through BC but it have few routine in it.
    2) Data in PSA is correct. But the DSO showz the double value.
    3) IO 0VALUE_LC is the cummulative values & has aagregation sum.
    4) I am using all standard objects. No enhancement.
    Ques :
    1) Is this the way the DSO 0CM_DS03 works?
    2) How can we have correct value?
    3) Do I need one more Z Object & divide by 2 to get the correct value?
    Please suggest.
    With Regards
    Rekha

    I hope you do not have multiple requests in the PSA.
    This may get aggregated and give you a wrong total in 0VALUE_LC for the same Material.
    Can you try de-bugging the code while the data is being updated into the ODS 0CM_DS03?
    You'll get a better idea.

  • Invalid monetary value?

    hi all
    plz could  you help me .when we are seeing in PLD design (in print preview mode) some particular items .
    This error is  showing "invalid monatary value"
    plz help me how could i solve this error?

    Dear Gangotri,
    Please check Note 905900. As per the Note, this message occurs when a template contains an Alphanumeric field (or any other non monetary field) and the "Display total in words" checkbox is ticked.
    A workaround is provided in the Note. Kindly refer to it for more detailed information.
    Regards,
    Lorna Real

  • Net value becoming double in a query

    Hi experts,
    We have a query based on an Infoset of Sales order header and AR_4.
    In the query output, against a customer the netvalue is becoming double in case of 2 acc doc, 3 times
    in case of 3 acc docs, 4 times in case of 4 acc docs like this it is increasing accordingly.
    How to solve this issue and get the netvalue only once ?
    Regards,
    Nishuv.

    Hi,
    "You will have to use calculated key figure for each of your key figures from the SALES doc cube(in this case net value) in the report and use exception aggregation with reference characteristic as accounting document number."
    Where should i maintain the exception aggregation i.e in the query designer level or while defining the
    key figure properties in modeling ?
    If in modeling, for netvalue in the aggregation tab should i mention the reference characteristic as acc
    doc no or sales doc no and option as Last or ?
    And also after loading data into the cube with these changes how to call that keyfigure in the query ?
    Please clarify these doubts.
    Regards,
    Nishuv.

  • Convert field value from Double to Date Time.

    Hi Every one.  Its been a long time since i have last posted on this site but i need some help again please.
    I want to convert a field value (saved as format double) to a date time value. I dont seem to find a function
    that can do this can anyone give me some help please?
    A sample would be to convert 40249.6588697106 to the format of Date Time being 12/03/2010 15:48:46
    Any suggestion?
    Thanks

    You can define a date time variable and use CDateTime.
    dim d as DateTime
    d = CDateTime(40179.55833333)
    formula = d

  • POC Value getting doubled when I run CNE1

    Hi,
    When ever I run CNE1 ( Progress analsis ) the POC vaue is getting doubled. If any one come across this issue, Please provide me a suggestion.
    I could not find any relavant notes also.
    Thanks & Regards
    Thiru

    Hi ,
    Thaks to all..
    After reconstructing the database, the POC values are got changed..
    But still there is issue again after the Execution of CNE1, the valuse are getting multiplied.
    Thanks & Regards
    Thiru

  • Check nbo decimal values of double

    Hi there!
    I need some advice on a topic:
    What is the best practice to check the number of decimal places, double values have (e.g. two decimal places are allowed, when there are more an exception has to be thrown)?
    I did some research, but could not find a truely satisfying solution.
    Hope you can help!
    greetz

    YoungWinston wrote:
    JoachimSauer wrote:
    You could try to get the String representation using String.valueOf() and check how many characters it contains after the decimal point. If the double value is really the result of the parsing of that String value, then the result should not have more digits than the original input...Are you sure that every possible value created by a string with up to 2 decimal places will convert back to the same string Joachim? It's possible, but I've never seen any confirmation of it.I'm not 100% sure, but I seem to remember some documentation to that effect. I was just too lazy to look it up ... I'm looking into it now.
    I think I found it:
    [Double.toString(double)|http://java.sun.com/javase/6/docs/api/java/lang/Double.html#toString(double)] says:
    How many digits must be printed for the fractional part of m or a? There must be at least one digit to represent the fractional part, and beyond that as many, but only as many, more digits as are needed to uniquely distinguish the argument value from adjacent values of type double.(emphasis mine)
    If my understanding is correct, then this rule ensures that the shortest possible String literal that parses into the same double value must be produced. So if the String literal "0.2" parses to the double value that you have, then Double.toString() must not produce 0.20, because that's more digits than would be necessary.
    Of course this approach breaks down if you exceed the possible precision of the double (i.e. if you have 15 digits before the decimal point, then anything after the decimal point will be lost/effectively random).

  • Jsp snippet not showing whole value of double

    I'm displaying a value as a double and only one digit after the decimal is showing up if the second digit is a 0. For example, the double 25.50 is showing up as 25.5.
    Does anyone know a good solution to this problem?
    Thanks in advance.

    The problem is you are trying to use a query string
    with the POST method.
    You should either
    (a) change your <form> tag to use the "get" method:
    <form name="c1" action="<%=base%>?action=create22" METHOD="get">
    or
    (b) remove the query string and add a hidden input
    <form name="c1" action="<%=base%> METHOD="post">
    <input type="hidden" name="action" value="create22">

  • MCTG value getting doubled

    Hi,
    When we are running MCTG for a particular sales organisation, the Incoming orders value is showing double value to the actual value. where could be the issue?
    Its happening only for one sales orgraisation and for other sales orgs its working fine. How and where to check this and correct this?
    What is the purpose of OLI8 and OLI9?
    Regards,
    Ajit
    Edited by: Ajit Chand on Sep 29, 2009 3:39 PM

    Hi Ajit
    If you are running MCTG report for a particular sales orgn as double time it is coming then check in your  enterprise structure how many sales offices are assigned to the sales orgn.
    The purpose of OLI8 & OLI9 is to update the past delivery and billing documents
    NOTE : Kindly search in the Forum before Posting some queries
    Regards
    Srinath

Maybe you are looking for

  • Using javascript variable in spry if statement

    is it possible to put a javascript variable in to the spry if statement to test? like <div spry:if="javascriptvar == {ds_RowNumber}".... thanks.

  • Error while applying patch no 9239089

    Hello, We are applying patch no 9239089 to EBS version 12.1.1 on WIndows 2003 R2 environment. While applying the patch on the application user we are getting the following error (adrelink.log) Starting link of product 'ad' on Wed May 22 16:23:16 IST

  • Transfering Back up from Time Machine to a Windows 7 computer

    I have a 1st Gen MacbookAir, LOVE IT! but the hard drive is failing and computer is on last leg...i do not have the money to replace it with another Mac, or to fix my harddrive, my only option is to purchase a cheaper PC laptop until i can either fix

  • Problem using app store

    In the app store icon I see a number of apps for update, but when I open the app store I can´t see the apps for update. This happend from my last iPhone update to 6.1.1 version.

  • Extended Withholding Tax error

    I have done EWT configuration. But while posting the entry, TDS is not deducted and no posting to TDS accounts are made. I have assigned GL accounts & done the settings in sequence given in SAP nodes What wrong setting i would have done ?