[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

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
10
Medium Priority
?
413 Views
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.
 
I'M ERRORING OUT ON THE REPEAT - PLEASE HELP ME



/*-------------------------------------------------------------------------------
Purpose: US Dollar Currency Conversion

Version History: // PRO375, UOP //
Name: CurrencyConversionLisaClarius03.c
Number: 3 // Week Three //
Date:09/27/04
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("***********************************************************************\n");
printf(" POS370 Currency Conversion Rates\n");
printf("     06 October 2004 /n ");
printf("***********************************************************************\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");
getchar();
return 0;

}

0
Comment
Question by:lclarius
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 2
10 Comments
 
LVL 11

Accepted Solution

by:
griessh earned 1500 total points
ID: 12413962
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();

======
Werner


======
Werner
0
 

Author Comment

by:lclarius
ID: 12414233
Werner thanks so much for the advice
do you mine if i resubmit to you for your advice once I complete this ?
Lclarius
0
 
LVL 5

Expert Comment

by:Dragonmen
ID: 12414272
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");
}else
{
//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);
}
scanf("%f",value);
}
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 11

Expert Comment

by:griessh
ID: 12414276
Lisa

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

Good luck!
0
 
LVL 11

Expert Comment

by:griessh
ID: 12414290
Dragonmen

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

Expert Comment

by:Dragonmen
ID: 12414489
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.
0
 

Author Comment

by:lclarius
ID: 12415029
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
0
 
LVL 11

Expert Comment

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

Author Comment

by:lclarius
ID: 12415151
Thank you and again I'm sorry ---
0
 
LVL 11

Expert Comment

by:griessh
ID: 12415190
Pssst! ... just don't tell anybody
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Make the most of your online learning experience.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Six Sigma Control Plans

656 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