Add Fractions problem: create in a sandbox environment. Directions: In this program you will ask the user for 4 integers that represtent 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

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter8: Arrays
Section: Chapter Questions
Problem 5GZ
icon
Related questions
Question
  • Add Fractions problem: create in a sandbox environment.
    • Directions: In this program you will ask the user for 4 integers that represtent 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, the following formula should be used: a/b + c/d = (a*d +b*c) / b* d

public class MyProgram

{

   public static void main(String[] args)

   {

      //Ask the user for 4 numbers. (don't forget to import your Scanner class)

     //create your final numerator

 

    //create your final denominator

 

   //print out your result like the example above

Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Returning value from Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage