Find Jobs
Hire Freelancers

Class Rational

$30-5000 USD

Em Andamento
Publicado há mais de 22 anos

$30-5000 USD

Pago na 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 do Projeto: 2829878

Sobre o projeto

15 propostas
Projeto remoto
Ativo há 23 anos

Quer ganhar algum dinheiro?

Benefícios de ofertar no Freelancer

Defina seu orçamento e seu prazo
Seja pago pelo seu trabalho
Descreva sua proposta
É grátis para se inscrever e fazer ofertas em trabalhos
Concedido a:
Avatar do Usuário
See private message.
$10 USD em 14 dias
5,0 (79 avaliações)
5,2
5,2
15 freelancers estão ofertando em média $32 USD for esse trabalho
Avatar do Usuário
See private message.
$25,50 USD em 14 dias
4,4 (19 avaliações)
5,9
5,9
Avatar do Usuário
See private message.
$29,75 USD em 14 dias
4,8 (43 avaliações)
5,4
5,4
Avatar do Usuário
See private message.
$42,50 USD em 14 dias
5,0 (48 avaliações)
5,2
5,2
Avatar do Usuário
See private message.
$25,50 USD em 14 dias
4,6 (60 avaliações)
4,5
4,5
Avatar do Usuário
See private message.
$21,25 USD em 14 dias
4,5 (33 avaliações)
4,2
4,2
Avatar do Usuário
See private message.
$40,80 USD em 14 dias
4,9 (7 avaliações)
3,4
3,4
Avatar do Usuário
See private message.
$3,40 USD em 14 dias
5,0 (9 avaliações)
3,2
3,2
Avatar do Usuário
See private message.
$30,60 USD em 14 dias
5,0 (5 avaliações)
3,2
3,2
Avatar do Usuário
See private message.
$12,75 USD em 14 dias
4,8 (16 avaliações)
3,1
3,1
Avatar do Usuário
See private message.
$17 USD em 14 dias
5,0 (5 avaliações)
1,8
1,8
Avatar do Usuário
See private message.
$42,50 USD em 14 dias
4,5 (1 avaliação)
1,3
1,3
Avatar do Usuário
See private message.
$102 USD em 14 dias
4,5 (4 avaliações)
1,2
1,2
Avatar do Usuário
See private message.
$42,50 USD em 14 dias
0,0 (0 avaliações)
0,0
0,0
Avatar do Usuário
See private message.
$21,25 USD em 14 dias
0,0 (0 avaliações)
0,0
0,0
Avatar do Usuário
See private message.
$29,75 USD em 14 dias
0,0 (1 avaliação)
0,0
0,0

Sobre o cliente

Bandeira do(a) UNITED STATES
United States
5,0
4
Membro desde out. 23, 2001

Verificação do Cliente

Obrigado! Te enviamos um link por e-mail para que você possa reivindicar seu crédito gratuito.
Algo deu errado ao enviar seu e-mail. Por favor, tente novamente.
Usuários Registrados Total de Trabalhos 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)
Carregando pré-visualização
Permissão concedida para Geolocalização.
Sua sessão expirou e você foi desconectado. Por favor, faça login novamente.