Another Custom Class (C++)

Κλειστό Αναρτήθηκε Apr 20, 2004 Πληρώθηκε κατά την παράδοση
Κλειστό Πληρώθηκε κατά την παράδοση

Create a class called Rational for performing arithmetic with fractions. Use the main function below to test your class.

Use integer variables to represent the private data of the class -- the numerator and the denominator. Provide a constructor function that enables an object of this class to be initialized when it is declared. The constructor should contain default values in case no initial values are provided and should store the fraction in reduced form (i.e., the fraction 2/4 would be stored in the object as 1 in the numerator and 2 in the denominator). Provide public member functions for each of the following:

a) Addition of two Rational numbers. The result should be stored in reduced form.

b) Subtraction of two Rational numbers. The result should be stored in reduced form.

c) Multiplication of two Rational numbers. The result should be stored in reduced form.

d) Division of two Rational numbers. The result should be stored in reduced form.

e) Printing Rational numbers in the form "a/b" where a is the numerator and b is the

denominator.

f) Printing Rational numbers in floating point format.

All the operations (addition, subtraction, multiplication and division) should be implemented using operator overloading.

## Deliverables

The following is the main function you should use, include header files when necessary.

int main()

{

Rational c(3,6), d(2,4), x;

[login to view URL]();

cout<<" + ";

[login to view URL]();

x = c + d;

cout<<" = ";

[login to view URL]();

cout<< '\n';

[login to view URL]();

cout<< " = ";

[login to view URL]();

cout<< "\n\n";

[login to view URL]();

cout<<" - ";

[login to view URL]();

x = c - d;

cout<<" = ";

[login to view URL]();

cout<< '\n';

[login to view URL]();

cout<< " = ";

[login to view URL]();

cout<< "\n\n";

[login to view URL]();

cout<<" * ";

[login to view URL]();

x = c * d;

cout<<" = ";

[login to view URL]();

cout<< '\n';

[login to view URL]();

cout<< " = ";

[login to view URL]();

cout<< "\n\n";

[login to view URL]();

cout<<" / ";

[login to view URL]();

x = c / d;

cout<<" = ";

[login to view URL]();

cout<< '\n';

[login to view URL]();

cout<< " = ";

[login to view URL]();

cout<< "\n\n";

return 0;

}

1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done.

2) Deliverables must be in ready-to-run condition, as follows (depending on the nature of the deliverables):

a) For web sites or other server-side deliverables intended to only ever exist in one place in the Buyer's environment--Deliverables must be installed by the Seller in ready-to-run condition in the Buyer's environment.

b) For all others including desktop software or software the buyer intends to distribute: A software installation package that will install the software in ready-to-run condition on the platform(s) specified in this bid request.

3) All deliverables will be considered "work made for hire" under U.S. Copyright law. Buyer will receive exclusive and complete copyrights to all work purchased. (No GPL, GNU, 3rd party components, etc. unless all copyright ramifications are explained AND AGREED TO by the buyer on the site per the coder's Seller Legal Agreement).

## Platform

Any Operating System

Must Compile

Μηχανολογία Linux MySQL PHP Αρχιτεκτονική Λογισμικού Δοκιμή Λογισμικού UNIX

Ταυτότητα Εργασίας: #3181409

Σχετικά με την εργασία

23 προτάσεις Απομακρυσμένη εργασία Ενεργό May 11, 2004

23 freelancers κάνουν προσφορές κατά μέσο όρο $13 για αυτή τη δουλειά

moderncoder

See private message.

$12.75 USD σε 3 μέρες
(327 Αξιολογήσεις)
8.1
xtremeideaz

See private message.

$12.75 USD σε 3 μέρες
(155 Αξιολογήσεις)
6.1
utopiaprogr

See private message.

$21.25 USD σε 3 μέρες
(62 Αξιολογήσεις)
5.4
unamigo

See private message.

$20.4 USD σε 3 μέρες
(51 Αξιολογήσεις)
5.3
gswzero

See private message.

$4.25 USD σε 3 μέρες
(45 Αξιολογήσεις)
4.5
lionel2vw

See private message.

$8.5 USD σε 3 μέρες
(12 Αξιολογήσεις)
3.7
gworroll

See private message.

$17 USD σε 3 μέρες
(41 Αξιολογήσεις)
3.7
pretzelvw

See private message.

$15.3 USD σε 3 μέρες
(21 Αξιολογήσεις)
3.8
xeontechlogixvw

See private message.

$12.75 USD σε 3 μέρες
(13 Αξιολογήσεις)
3.6
neo4vw

See private message.

$5.95 USD σε 3 μέρες
(16 Αξιολογήσεις)
3.1
karsazsoft

See private message.

$12.75 USD σε 3 μέρες
(15 Αξιολογήσεις)
3.1
nick76

See private message.

$25.5 USD σε 3 μέρες
(3 Αξιολογήσεις)
2.8
cperi

See private message.

$10.2 USD σε 3 μέρες
(14 Αξιολογήσεις)
2.9
saifullahbaig

See private message.

$3.4 USD σε 3 μέρες
(9 Αξιολογήσεις)
2.2
devipvw

See private message.

$8.5 USD σε 3 μέρες
(1 Κριτική)
0.4
tikovw

See private message.

$29.75 USD σε 3 μέρες
(0 Αξιολογήσεις)
0.0
vw1160711vw

See private message.

$8.5 USD σε 3 μέρες
(0 Αξιολογήσεις)
0.0
endwin

See private message.

$17 USD σε 3 μέρες
(0 Αξιολογήσεις)
0.0
urugvw

See private message.

$3.4 USD σε 3 μέρες
(0 Αξιολογήσεις)
0.0
catalinboldan

See private message.

$8.5 USD σε 3 μέρες
(0 Αξιολογήσεις)
0.0