Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Can you give me this program in C++ please. I send it before and the program you gave me doesn't work 1:47 PM 10% .oooo
Can you give me this program in C++ please. I send it before and the program you gave me doesn't work
1:47 PM 10% .oooo H20 ehacc.hacc.edu College Fahringer CPS 161 Computer Science Program #5 20 points Algorithm Due: Thursday, Feb 25th Program Due: Saturday, Feb 27th Fractions Task: Add several pairs of fractions and sim the resulting sums. plify The program should be able to manage signed numbers, like or unlike denominators, and input values of zero in either a numerator or a denominator. Azero denominator should be handled by printing an appropriate error message in the output file and without causing a program abend. The final sums should be reduced to lowest terms, and improper fractions should be converted to mixed numbers. Use the Euclidean algorithm to find the GCF to simplify fractions. Organize the program with appropriate functions. The program will be submitted in C++, with pseudocode. Input: For each pair of fractions, accept input values for numerator 1, denominator 1, numerator 2, and denominator 2. The input data file is: P5Fractions.txt. All the input values are integers. Here are the fractions that will be added: Output: Print an appropriate header in the output file, and then print each pair of addend fractions and their sum. Note that negative signs should not be displayed in a denominator. Ifa mixed number is negative, print only one minus sign (ie., print -1 1/4 rather than 1-1/4). If the final result is an integer, no fraction portion should be displayed. If the final result is only a fraction with no whole number part, do not print a whole number of o Sample output: 3/8 1/6 13/24 9/2 7/2 8/9 11/3 4 5/9 1/6 5/6 2/3 Suggestions You might want to simplify the answer after combining the 1:47 PM 10% .oooo H20 ehacc.hacc.edu College Fahringer CPS 161 Computer Science Program #5 20 points Algorithm Due: Thursday, Feb 25th Program Due: Saturday, Feb 27th Fractions Task: Add several pairs of fractions and sim the resulting sums. plify The program should be able to manage signed numbers, like or unlike denominators, and input values of zero in either a numerator or a denominator. Azero denominator should be handled by printing an appropriate error message in the output file and without causing a program abend. The final sums should be reduced to lowest terms, and improper fractions should be converted to mixed numbers. Use the Euclidean algorithm to find the GCF to simplify fractions. Organize the program with appropriate functions. The program will be submitted in C++, with pseudocode. Input: For each pair of fractions, accept input values for numerator 1, denominator 1, numerator 2, and denominator 2. The input data file is: P5Fractions.txt. All the input values are integers. Here are the fractions that will be added: Output: Print an appropriate header in the output file, and then print each pair of addend fractions and their sum. Note that negative signs should not be displayed in a denominator. Ifa mixed number is negative, print only one minus sign (ie., print -1 1/4 rather than 1-1/4). If the final result is an integer, no fraction portion should be displayed. If the final result is only a fraction with no whole number part, do not print a whole number of o Sample output: 3/8 1/6 13/24 9/2 7/2 8/9 11/3 4 5/9 1/6 5/6 2/3 Suggestions You might want to simplify the answer after combining the Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started