473,385 Members | 1,372 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Currency Conversion using OO

I'm trying to learn how to use C++, the OO way. I need help with a
simple program im doing to convert currency by creating a class for
this ADT. I know it should have a header file, main program,program
with functions, Constructor with arguments; default constructor with no
arguments;add, subtract, scalar multiply;show. Also I want it to show
all the #'s in cents and not round to 2 decimal places. I am struggling
to see how to use all 3 of these to convert cents to dollars and vice
versa. I already have 2 variables dollars & cents & im thinking i need
to convert both to a single variable then do the math. After this point
im stuck. Could you help me please, I would be very grateful.

2) Also, do u have any idea how to do dot product, scalar product,
magnitude, direction operations on a vector using OO?

Oct 11 '05 #1
3 3260
"Willing 2 Learn" writes:
I'm trying to learn how to use C++, the OO way. I need help with a
simple program im doing to convert currency by creating a class for
this ADT. I know it should have a header file, main program,program
with functions, Constructor with arguments; default constructor with no
arguments;add, subtract, scalar multiply;show. Also I want it to show
all the #'s in cents and not round to 2 decimal places. I am struggling
to see how to use all 3 of these to convert cents to dollars and vice
versa. I already have 2 variables dollars & cents & im thinking i need
to convert both to a single variable then do the math. After this point
im stuck. Could you help me please, I would be very grateful.
The class should have only one datum:

long cents;

Convert as necessary, both input and output. The long might be a problem in
a real program (too small) but it is OK to use in learning the
fundamentals.
2) Also, do u have any idea how to do dot product, scalar product,
magnitude, direction operations on a vector using OO?


Yes.
Oct 11 '05 #2
Willing 2 Learn wrote:
I'm trying to learn how to use C++, the OO way. I need help with a
simple program im doing to convert currency by creating a class for
this ADT. I know it should have a header file, main program,program
with functions, Constructor with arguments; default constructor with no
arguments;add, subtract, scalar multiply;show. Also I want it to show
all the #'s in cents and not round to 2 decimal places. I am struggling
to see how to use all 3 of these to convert cents to dollars and vice
versa. I already have 2 variables dollars & cents & im thinking i need
to convert both to a single variable then do the math. After this point
im stuck. Could you help me please, I would be very grateful.
Help you, how?
2) Also, do u have any idea how to do dot product, scalar product,
magnitude, direction operations on a vector using OO?


Yes, I do.

V
Oct 11 '05 #3
In article <3r************@individual.net>,
osmium <r1********@comcast.net> wrote:
"Willing 2 Learn" writes:
I'm trying to learn how to use C++, the OO way. I need help with a
simple program im doing to convert currency by creating a class for
this ADT. I know it should have a header file, main program,program
with functions, Constructor with arguments; default constructor with no
arguments;add, subtract, scalar multiply;show. Also I want it to show
all the #'s in cents and not round to 2 decimal places. I am struggling
to see how to use all 3 of these to convert cents to dollars and vice
versa. I already have 2 variables dollars & cents & im thinking i need
to convert both to a single variable then do the math. After this point
im stuck. Could you help me please, I would be very grateful.


The class should have only one datum:

long cents;

Convert as necessary, both input and output. The long might be a problem in
a real program (too small) but it is OK to use in learning the
fundamentals.


Also, don't know the OP motivation, but have a look at the
numeric and money capabilities found in <locale>
--
Greg Comeau / Celebrating 20 years of Comeauity!
Comeau C/C++ ONLINE ==> http://www.comeaucomputing.com/tryitout
World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?
Oct 11 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: techy techno | last post by:
hii Experts..!! I need someone to tell me where I can get a Currency Converter like http://cconv.textor.com please can someone tell me where I can get it I need it for free + I dont need...
2
by: Willing 2 Learn | last post by:
I'm still having trouble getting my program to do arithmetic in cents(keeping all #'s) then convert the answer in a format of dollars & cents. The main program should add, subtract, scalar...
3
by: Josh | last post by:
I am writing a program where the user inputs currency in US dollars. I want the program to only accept valid currency input, converting the string into the proper type of variable (double?), and...
11
by: Adrian | last post by:
Hi I want to use the following declarations but vb dotnet keeps complaining that currency can't be used because it private ? I have tried it in a module and in the declaration pare same error!...
7
by: meenasamy | last post by:
Hi all, i need to create a function that takes three parameters( Original currency, needed currency, amount) i need to convert from the original currency to the needed currency the amount and...
2
by: sck10 | last post by:
Hello, I have a SQL Server 2K table with a field set to currency. When I try to insert or update a FormView, I get the following error: Disallowed implicit conversion from data type nvarchar...
10
by: jayender.vs | last post by:
Hello guys, I need to know the Currency conversion code in Javascript Say for example i got 2 textbox .. where i enter a number (singapore doller value) and i provide a button and in the next text...
18
by: Boris Yeltsin | last post by:
OK, I have a database table, it has prices of products in it, like so: ProductPrice MONEY ProductIsoCurrencyCode CHAR(3) Now, both CultureInfo and RegionInfo have...
16
by: xjohnx | last post by:
Hi, I'm hoping someone can help me I am quite new to Javascript and have had to create a programme which converts dollars into euros and vice versa, here is my script which is working var...
25
by: mereba | last post by:
Hello My country Ghana is changing its currency. I want to write a small programme in C++ that can covert from the old currency into the new one. I would like this programme to run behind a simple...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.