Question: ( In C + + ) Write the definitions of the functions of the class primeFactorization ( Example 1 1 - 4 ) declared in
In CWrite the definitions of the functions of the class primeFactorization Example declared in the primeFactorization header file. Write a program that uses this class to output the prime factorization of an integer. Your program should prompt the user for an integer, determine if the input is a prime number, and display the factorization of the integer.
An example of the program is shown below:
Enter an integer between and :
is a prime number. Its factorization is:
Provided;
integerManipulation.h;
#ifndef integerManipulationH
#define integerManipulationH
class integerManipulation
public:
void setNumlong long n;
Function to set num.
Postcondition: num n;
long long getNum;
Function to return num.
Postcondition: The value of num is returned.
void reverseNum;
Function to reverse the digits of num.
Postcondition: revNum is set to num with digits in
in the reverse order.
void classifyDigits;
Function to count the even, odd, and zero digits of num.
Postcondition: evenCount the number of even digits in num.
oddCount the number of odd digits in num.
int getEvensCount;
Function to return the number of even digits in num.
Postcondition: The value of evensCount is returned.
int getOddsCount;
Function to return the number of odd digits in num.
Postcondition: The value of oddscount is returned.
int getZerosCount;
Function to return the number of zeros in num.
Postcondition: The value of zerosCount is returned.
int sumDigits;
Function to return the sum of the digits of num.
Postcondition: The sum of the digits is returned.
integerManipulationlong long n ;
Constructor with a default parameter.
The instance variable num is set accordingto the parameter,
and other instance variables are set to zero.
The default value of num is ;
Postcondition: num n; revNum ; evenscount ;
oddsCount ; zerosCount ;
private:
long long num;
long long revNum;
int evensCount;
int oddsCount;
int zerosCount;
;
#endif
primeFactorization.h;
#ifndef primeFactorizationH
#define primeFactorizationH
#include "integerManipulation.h
class primeFactorization: public integerManipulation
public:
void factorization;
Function to output the prime factorization of num
Postcondition: Prime factorization of num is printed;
primeFactorizationlong long n ;
Constructor with a default parameter.
The instance variables of the base class are set according
to the parameters and the array firstPrimes is
created
Postcondition: num n; revNum ; evenscount ;
oddsCount ; zerosCount ;
firstPrimes first prime numbers.
private:
long long firstPrimes;
void primeFactlong long num, long long list int length,
int firstPrimeFactIndex;
void firstPrimeNumlong long list int length;
Function to determine and store the first prime
integers
Postcondition: The first prime numbers are
determined and stored in the array firstPrimes;
void primeTestlong long num, long long list int length,
bool& primeNum, int& firstPrimeFactIndex;
bool isPrimelong long number;
;
#endif
Needed; primeFactorizationImp.cpp IntegerManipulatonImp.cpp and main.cpp Even better if it works for GitHub. Thank you
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
