Find Jobs
Hire Freelancers

Class Rational

$30-5000 USD

En curso
Publicado hace más de 22 años

$30-5000 USD

Pagado a la entrega
Create a class called Rational for performing arithmetic operations with fractions. Create a console application program. Give your workspace folder the name "Fraction and the client program file the name 'fraction.cpp.' The class definition must include the following: (1)use integer type variables for the private data members of the class and name them as numerator and denominator.(2)provide three constructor methods as follows. A default constructor method that sets numerator=0,and denominator=1. A constructor method with one parameter to set the numerator to the argument value and set the denominator=1. A constuctor method with two parameters to set the numerator and denominator to the argument values. This constructor method using a private method named standardize(),stores the private members in such a way that the numerator is negative whenever the rational number is negative, and both numerator and denominator are positive whenever the rational number is positive. (3)provide the following public member functions (a)Rational add(Rational);purpose:to add the argument rational number to the current rational number and return the resulting rational number(b)Rational subtract(Rational);(c)Rational multiply(Rational);(d)Rational divide(Rational);(e)void display(); purpose:to insert on the standard output stream the current rational number in the form a/b. Your client program must include statements to: (1)accept two integers from the user,then create a rational object 'r1' and display it.(2)accept one non-zero integer from the user, then create a rational object 'r2' and display it.(3)create a rational object 'r3' using the default constructor and then display it.(4)display r1+r2 using the add method(5)display r1+r3 using the add method (6)display r1-r2 using the subtract method (7)display r1*r2 using the multiply method (8)display r1/r2 using the divide method. ## Deliverables I had to put part of the description on this part. Complete and fully-functional working program(s) in executable form as well as complete source code of all work done. And all problems from the disciption ************************* DESCRIPTION (cont'd) Sample run for your program: Enter two integers with second one non-zero:2,-3 You have entered r1= -2/3 Enter an integer:5 You have entered r2=5/1 Default rational is r3= 0/1 r1+r2=13/3 r1+r3=-2/3 r1-r2=-17/3 r1*r2=-10/3 r1/r2=-2/15 Suppose the user enters -2,-3 then your appropriate constructor method must store numerator =2 and denominator =3. A rational number has negative numerator only when it is negative:-2/3 Provide a private void method simplify() to store the numerator and denominator of the current rational in the reduced form with the greatest common divisor of the numerator and denominator equal to 1. For example, if a current rational object has a numerator =15 and denominator =12 then a call to simplify() will change the numerator to 5 and denominator to 4. I need this written in Microsoft Visual C++ 6.0
ID del proyecto: 2829878

Información sobre el proyecto

15 propuestas
Proyecto remoto
Activo hace 23 años

¿Buscas ganar dinero?

Beneficios de presentar ofertas en Freelancer

Fija tu plazo y presupuesto
Cobra por tu trabajo
Describe tu propuesta
Es gratis registrarse y presentar ofertas en los trabajos
Adjudicado a:
Avatar del usuario
See private message.
$10 USD en 14 días
5,0 (79 comentarios)
5,2
5,2
15 freelancers están ofertando un promedio de $32 USD por este trabajo
Avatar del usuario
See private message.
$25,50 USD en 14 días
4,4 (19 comentarios)
5,9
5,9
Avatar del usuario
See private message.
$29,75 USD en 14 días
4,8 (43 comentarios)
5,4
5,4
Avatar del usuario
See private message.
$42,50 USD en 14 días
5,0 (48 comentarios)
5,2
5,2
Avatar del usuario
See private message.
$25,50 USD en 14 días
4,6 (60 comentarios)
4,5
4,5
Avatar del usuario
See private message.
$21,25 USD en 14 días
4,5 (33 comentarios)
4,2
4,2
Avatar del usuario
See private message.
$40,80 USD en 14 días
4,9 (7 comentarios)
3,4
3,4
Avatar del usuario
See private message.
$3,40 USD en 14 días
5,0 (9 comentarios)
3,2
3,2
Avatar del usuario
See private message.
$30,60 USD en 14 días
5,0 (5 comentarios)
3,2
3,2
Avatar del usuario
See private message.
$12,75 USD en 14 días
4,8 (16 comentarios)
3,1
3,1
Avatar del usuario
See private message.
$17 USD en 14 días
5,0 (5 comentarios)
1,8
1,8
Avatar del usuario
See private message.
$42,50 USD en 14 días
4,5 (1 comentario)
1,3
1,3
Avatar del usuario
See private message.
$102 USD en 14 días
4,5 (4 comentarios)
1,2
1,2
Avatar del usuario
See private message.
$42,50 USD en 14 días
0,0 (0 comentarios)
0,0
0,0
Avatar del usuario
See private message.
$21,25 USD en 14 días
0,0 (0 comentarios)
0,0
0,0
Avatar del usuario
See private message.
$29,75 USD en 14 días
0,0 (1 comentario)
0,0
0,0

Sobre este cliente

Bandera de UNITED STATES
United States
5,0
4
Miembro desde oct 23, 2001

Verificación del cliente

¡Gracias! Te hemos enviado un enlace para reclamar tu crédito gratuito.
Algo salió mal al enviar tu correo electrónico. Por favor, intenta de nuevo.
Usuarios registrados Total de empleos publicados
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Cargando visualización previa
Permiso concedido para Geolocalización.
Tu sesión de acceso ha expirado y has sido desconectado. Por favor, inica sesión nuevamente.