US dollar inputs are from .01 to 1000.00. Have the program repeat after it displays the results. Have the program use the value of 0 to end. All other input values are rejected with an error message a

Posted on 2004-10-26
Last Modified: 2011-09-20

US dollar inputs are from .01 to 1000.00. Have the program repeat after it displays the results. Have the program use the value of 0 to end. All other input values are rejected with an error message and warning.
Use a function for the input question and a function for the currency conversion display parts of the program.

Purpose: US Dollar Currency Conversion

Version History: // PRO375, UOP //
Name: CurrencyConversionLisaClarius03.c
Number: 3 // Week Three //
Student Programmer: Lisa Clarius
Verison: IA Wk 2 // revised for Wk 4//
Purpose: Week Four IA coding
Date Revised: 10/06/04
Revised by: LDC
Instructor: Lon Hosford

#include <stdio.h>    
int main ()

            /*Variables for the various exchange rates */
/* The variables names represent the foreign nations. Exchange reates were obtain */
/* from The Federal Reserve Bank of New York, representing the time 12:00 noon */
/* buying rates and the International Monetary Fund according to thier availability  */

// -------------------------------------------------------------------------------------//

            float British = 0.557227;
            float Canadian = 1.2886;
            float European = 0.815395;
            float Australian= 1.42633;
            float Mexican = 11.4275;


/* Variables for the demominations rate of the foreign currencies */
/* The variable names are representatives of foreign nations*/
            char British_unit[]="pounds";
            char Canadian_unit[]= "dollars";
            char European_unit[]= "euros";
            char Australian_unit[]="dollars";
            char Mexican_unit[]="pesos";
      /*Display the the value of the foreign exchange currency  to one USdollar*/    
/*------------------------------------------------------------------------------------------- */
  scanf("%f,&value"); /* for one USdollar */
/*Display report title and date of conversion */
printf(" POS370 Currency Conversion Rates\n");
printf("     06 October 2004 /n ");
 /* Display the exchange rates and verify USdollar inputs for British, Candian, European, Augralian and Mexican */
printf ("Exchange Rates For US $1.00\n\n");
printf ("   Country       Rate\n");
printf ("-------------------------------------------------------------------------------------------------------\n\n");
printf ("Great Britian: %f%s\n",British, British_unit);
printf ("      Canada:  %f%s\n",Canadian,Canadian_unit);
printf ("      Europe:  %f%s\n",European, European_unit);  
printf ("   Australia:  %f%s\n", Australian, Australian_unit);
printf ("      Mexico:  %f%s\n", Mexican, Mexican_unit);

/*Display USdollar amount and verify all foreign currency */

printf("Enter a dollar amount .01 to 1000.00 for all listed currencies to one USdollar");  

/*Display variable repeat and the value for USdollar */
repeat=='y'|| repeat =='y';
Usdollars<=.01 && USdollars>=1000.0;
endOFFile== EOF                        
printf(" Foreign currencies verfiy to one USdollar").
printf ("The End")
printf("Press Enter to end Program\n");
return 0;


Question by:lclarius
    LVL 12

    Accepted Solution

    Hi lclarius,

    We cannot do your homework, but I can give you some advice:

    In order to program a 'repeat' you have to use one of the loop commands.

    while ( user doesn't want to stop) do
      read next value to be converted;
      calculate the values of the other denominations
      print the values
      ask whether to stop now;

    - before you use a variable you have to declare it;
    - C/C++ is case sensitive, that means "Usdollars" and "USdollars" are two diffrent variables;
    - look up the syntax od scanf();



    Author Comment

    Werner thanks so much for the advice
    do you mine if i resubmit to you for your advice once I complete this ?
    LVL 5

    Expert Comment

    I'm sorry if i made some mistake. I gived up C, so i do this only from a memory. Don't evan have a compiler to test this. :)          

    do this:
    float value,brcur,cancur,eurcur,auscur,mexcur; //declaration part, should be above

    scanf("%f",value); /* for one USdollar */
    while (value!=0) do
    if (value<.01 && value>1000.0)
    //input is wrong
    printf("Error:Wrong input. Range should be between 0.01 and 1000.00");
    //input is right
    brcur=British*value; cancur=Canadian*value; eurcur=European*value; auscur=Australian*value; mexcur=Mexican*value;
    printf ("Exchange Rates For US %f\n\n",value);
    printf ("   Country      Rate\n");
    printf ("-------------------------------------------------------------------------------------------------------\n\n");
    printf ("Great Britian: %f%s\n",brcur, British_unit);
    printf ("      Canada:  %f%s\n",cancur,Canadian_unit);
    printf ("      Europe:  %f%s\n",eurcur, European_unit);  
    printf ("   Australia:  %f%s\n", auscur, Australian_unit);
    printf ("      Mexico:  %f%s\n", maxcur, Mexican_unit);
    LVL 12

    Expert Comment


    That's fine. But don't only rely on me, others might join in,too.

    Good luck!
    LVL 12

    Expert Comment


    Why are you doing this? You are here long enough to know that this is not allowed.
    LVL 5

    Expert Comment

    I missed first part where it says it's an exam. I tought it's a syntax error in the code or something.
    I hope the admin will delete this post.

    Author Comment

    i'm sorry guys this is not an exam just a home work - I don't want any one to do my work for me I just had a question sorry for the inconvenience Lclarius
    LVL 12

    Expert Comment

    With a copy & paste you have your solution now. Use it well to learn what you missed :-)

    Author Comment

    Thank you and again I'm sorry ---
    LVL 12

    Expert Comment

    Pssst! ... just don't tell anybody

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    INTRODUCTION We all know how to code. But at times you simply want to insert a common code block into your existing code and amend it as per your requirements. This tool not only saves you time but also saves you the pain of typing it all out aga…
    Purpose To explain how to place a textual stamp on a PDF document.  This is commonly referred to as an annotation, or possibly a watermark, but a watermark is generally different in that it is somewhat translucent.  Watermark’s may be text or graph…
    Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
    In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

    933 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now