473,397 Members | 1,972 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,397 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 3261
"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...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.