In this program you will ask the user for 4 integers that represent two fractions. First ask for the numerator of the first and then the denominator. Then ask for the numerator and denominator of the second. Your program should add the two fractions and print out the result. For example, a sample program run might look like this Numerator One: 1 Denominator One: 2 Numerator Two: 2 Denominator Two: 5 The sum is 9/10 Remember, if you have two fractions you add them with: a c ad + bc __ + ___ = ______ b d bd public class AddFractions { public static void main(String[] args) { //Ask user for the 4 numbers and create necessary variables. //create your final numerator //create your final denominator
In this program you will ask the user for 4 integers that represent two fractions. First ask for the numerator of the first and then the denominator. For example, a sample program run might look like this Numerator One: 1 Remember, if you have two fractions you add them with: a c ad + bc |
public class AddFractions |
{ |
public static void main(String[] args) |
{ |
//Ask user for the 4 numbers and create necessary variables. |
//create your final numerator |
//create your final denominator |
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images