Dev C++ Currency Converter

  
Dev C++ Currency Converter 6,7/10 4794 votes

Unit 12

Unit 12 assignment 1 - For this assignment I was given the following scenario : 'You are a programme working for a software development company. Your manager has asked you to look at two programs shown below as program 1 and program 2.'
Unit 12 assignment 2 - For this assignment I was given the following scenario : 'The manager in charge of the currency exchange in a local HSBC bank has asked you to design a program which can convert different currencies based on a given exchange rate. You should explain how your design meets the user requirements when addressing the problem.'
Unit 12 assignment 3 -For this assignment I was given the following scenario : 'The manager in charge of the currency exchange of the local HSBC bank likes your solution for the currency converter (assignment 2). That manager has asked you to develop your program solution, requiring you to structure your approach for maintainability, by including a commentary within the code. You will need to test the program against a test plan of your own devising, checking that the client’s requirements are still being met and documenting any changes that you have made to the program since the previous assignment. Be sure to fix any faults in the program as you work from design to implementation.
You will then need to get feedback on the program from one other person, including how easy it is to use and the quality of the code. Review and refine your program in the light of that feedback.
This needs to be fully documented.'
Unit 12 assignment 4 - For this assignment I was given the following scenario : 'Looking back at the program that you have developed, your manager wants you to write a report or documentation. Your documentation must include the following:
1. How your program may be improved or developed further
2. The strengths and points you could improve.
3. Justify where your design has changed during the development, including what has changed following feedback, and explain how you would improve the program further.'
  1. Dev C Currency Converter Pdf
  2. Dev C Currency Converter Online

Jun 07, 2007  Creating a singleton object to hold it would definitely be effective. The reason I mentioned ICloneable was because if you use the SitesInfo.GetSite(2) and get back the Canadian language setting (for example), you could then change the values using the returned reference. Aug 21, 2017 Question: In the heyday of the British Empire, Great Britain used a monetary system based on pounds, shillings, and pence. There were 20 shillings to a pound, and 12 pence to a shilling. Free currency calculator to convert between most of the global currencies using live or custom exchange rates. Also check the latest exchange rate of most currencies, experiment with other financial calculators, or explore hundreds of individual calculators addressing other topics such as math, fitness, health, and many more. Feb 02, 2008  I am trying to convert five currencies and their equivalents to the us dollar 1 Yen = 0.008431 1 Euro = 1.3698 1 Can $ = 0.9437 1 U.K. = 2.0336 1 AU$ = 0.8509.

14 Apr 2004

Introduction

While developing some sort of accounting application I ran into a problem of supporting several currencies and performing various computations with them. After digging in MSDN I understood that neither Windows API itself nor MFC (or any other class libraries) doesn't offer proper support for currency management - and that was the reason for developing my own set of classes.

Best auto tune settings for baritone. Lead vocalsSome recording engineers think compression is a must for vocals. It evens out the often-erratic levels that a singer can produce and tames transients that can cause digital distortion.

Background

The database, which was the backbone of the application, along with many other tables, has these two tables (we're not interested in Product Categories):

The thing is: we have Suppliers with their Products. Every product has its Purchase Price, Overheads and Shop Price. The latter (namely Shop Price) is independent from Suppliers' Currency ID and all the remaining currency-related fields do depend on it. As program runs, it is required to perform various computations (calculating income, bills, etc.) so this is where the problem was.

The very first idea (not a first-rate one, actually) was of a kind:

  • Declare several variables (one for each currency)..
  • ..and have following almost identical code pieces here and there:

It is obvious that this approach has a lot of drawbacks. First off, it gives no flexibility (in case I would like to add one more currency I would have to look through all the source code just to add one more case to each switch block. Second, the burden of managing all currency-related stuff (formatting, performing calculations, etc.) rests on programmer's soulders. These four classes appeared to be a solution of the problem (at least in my case). Here we go.

The Reference

CCurrency

Well, the name speaks for itself - a basic currency class with plenty of capabilities.

All kinds of constructors. CYID (a typedef for unsigned long) is a Currency Identifier. It would be better to use non-clashing identifiers in a program. The dValue is the initial numerical value of your Currency object. szCurrencyName is a human-readable name of the currency represented by the object (US Dollar, for instance) szCurrencySign is the sign of the currency ($ or whatever). szStockName is an international name of the currency (I guess USD is the thing). So the construction can look like this:

Resets Currency object (that is, sets m_dValue and m_lSummands to 0).

Dev C Currency Converter Pdf

I felt too lazy to write proper accessors/mutators, so this is a quick and dirty solution - but nevertheless it works perfectly. Take a look in macros.h.

Arithmetical operations on CCurrency objects (surprise, surprise!).

CCurrencyManager

This is actually a container for CCurrency objects with somw additional features.

Registers rCy within a manager. Currency Manager uses std::map, so a copy is inserted. Just for information - to see properties of currencies registered within a Manager.

These six are used to work with formatting strings. They are usual C-style format strings (remember or refer to printf() documentation). The only thing to say about them is that Summands Format expects formatting string suitable to format long values and two remaining strings (Average Format and Value Format) expect a double-suitable format string. For instance:

Three versions of formatting functions. Just like sprintf() it expects an output buffer (szBuffer here), a format string (szFormatString) and data to be used when formatting. The first version expects a CCurrency object, whose fields will be used while formatting. The second version needs just Currency Identifier. It looks if such currency is registered in the Currency Manager and if it finds one uses its fields (including Value - see next function). Otherwise it returns empty output buffer. The last version does almost the same thing as the previous one, but it uses user-supplied dValue instead of a value of a Currency object found. There are specific formatting flags and they are as follows:

FlagMeaning
%nameCurrency Name (see szCurrencyName in CCurrency constructor).
%signCurrency Sign
%stockCurrency Stock Name
%smndNumber of summands in the Currency object
%valValue of the Currency object
%avgAverage value of the Currency object
So the code snippet can look like:

As usual - arithmetical operations. Please note, that if you add or subtract a currency which was not registered in the destination manager a new currency is not registered and the state of a Currency Manager remains intact.

CCurrencyExchange

You would rarely need to use this class directly. It contains information required to perform conversions between two currencies, called Primary and Secondary. Exchange rate used to convert from Primary to Secondary is called Direct Exchange Rate. Exchange rate used to convert from Secondary to Primary is called Reverse Exchange Rate.

Constructs

Dev C Currency Converter Online

CCurrencyExchange object with given characteristics.

Accessors/mutators - and nothing more.

CCurrencyExchangeManager

Does almost the same thing as CCurrencyManager - manages currency exchange operations.

Registers Currency Exchange object within the manager. Returns or alters defined exchange rate (in case Currency Exchange object with given IDs is registered in a Currency Exchange Manager). Two variants of Exchange() method. First one exchanges from rCy.GetCurrencyID() to cyDest and places the result to rCy, altering its Currency ID member variable. Note that it doesn't change any of the string member variables. The second variant exchanges from rCySrc.GetCurrencyID() to rCyDest.GetCurrencyID() and places the result in rCyDest. All exchanges are performed if proper Currency Exchange object is registered within a Currency Exchange Manager. For example:

Feedback

This set was initially created for my personal use, so it may not fully suit your need. If you liked the stuff, please vote. If you have any problems - mail or post messages over here.

History

  • 15 April 2004 - Initial release