1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
vekshin1
3 years ago
15

Write a program that reads two fractions such as 1/2 and 1/4 and computes and stores the sum, the difference, the product and th

e result of dividing one by the other in four other fractions, respectively. Display the four resulting fractions. The following is a sample interaction between the user and the program: Enter two fractions: 1/2 1/4 Sum fraction: 6/8 Difference: 2/8 Product: 1/8 Quotient: 4/2 Press any key to continue. If n1/d1 and n2/d2 are the two fractions, their sum is given by: n1d2+ n2d1/d1d2 their difference is given by: n1d2-n2* d1/d1d2 Product is: n1n2/d1d2 Quotient: nl. d2/d1n2 Make sure the program pauses and waits for a key to be pressed before continuing. Put your name on top as a comment. Use comments to explain where your code may not be clear enough. After building and testing the program, submit the cpp file. There are two steps in submitting an assignment: first click Choose File and once you locate the file, click Upload to upload it. Once you have uploaded the file click Finish to submit. It will not be submitted until you click Finish. Make sure not to click Finish before uploading the files, as it will send a blank page and you can't resubmit. Each student must write his or her own program.
Computers and Technology
1 answer:
Vesnalui [34]3 years ago
5 0

Answer:

1: #include <iostream>

2: using namespace std;

3: int main()

4: {

5: int a,b,c,d;

6: cout<<"n1: ";

7: cin>>a;

8: cout<<"d1: ";

9: cin>>b;

10: cout<<"n2: ";

11: cin>>c;

12: cout<<"d2: ";

13: cin>>d;

14: int top = (a*d)+(b*c);

15: int bottom = b*d;

16: cout<<"Sum: "<<top<<"/"<<bottom<<"\n";

17: top = (a*d)-(b*c);

18: cout<<"Difference: "<<top<<"/"<<bottom<<"\n";

19: top = a*c;

20: cout<<"Product: "<<top<<"/"<<bottom<<"\n";

21: top = a*d;

22: bottom = b*c;

23: cout<<"Quotient: "<<top<<"/"<<bottom<<"\n";

24: return 0;

25: }

Explanation:

The Program is written in C++ programming language

The Program is left numbered

Line 5 was used for variable declaration.

Variables a,b represents the numerator and denominator of the first fraction

While variables c,d represent the numerator and denominator of the second fraction

Line 6 prints "n1" without the quotes which represents the numerator of the first fraction

Line 7 accepts input for the numerator of the first fraction.

Line 8 prints "d1" without the quotes which represents the denominator of the first fraction

Line 9 accepts input for the denominator of the first fraction.

Line 10 prints "n2" without the quotes which represents the numerator of the second fraction

Line 11 accepts input for the numerator of the second fraction.

Line 12 prints "d2" without the quotes which represents the denominator of the second fraction

Line 13 accepts input for the denominator of the second fraction.

Line 14 and 15 calculate the sum of the fractions which is then printed on line 16

Line 17 calculates the difference of the fractions which is then printed on line 18

Line 19 calculates the product of the fractions which is then printed on line 20

Line 21 and 22 calculates the quotient of the fractions which is then printed on line 23

You might be interested in
Compare the applications below:
Karo-lina-s [1.5K]
The answer is the first response, by order of elimination, you can eliminate the rest.

HTML is a programming language that is used to design websites. You don't need to program a website to make a post on instagram, especially if you are using the app.

If you check the app store on your phone, you can find instagram in the app store, which lets you access it from your mobile device. Thus, the third option is wrong.

Finally, just read the description of instagram. It was made for sharing pictures, so the last option is wrong.
3 0
3 years ago
Hi!
baherus [9]

Answer:

Radius = 14 cm = 0.00014 km

Circumference = 2πr = 2 × 22/7 × 14/100000 = 0.00088 km

As it went thousand times , distance covered = 0.00088 × 1000 = 0.88 km

8 0
3 years ago
15)Which of the following statements is generally true about a V8 engine...
Vladimir79 [104]

Answer: Generally, there is an increase in power with a V8 engine.

Explanation:

A V8 engine has a bigger engine that cars with a V4 or V6 engines. They can go faster and gain speed at a faster rate than the other cars. They are not good on gas and use more gas than other cars with smaller engines.

Two things that are great about having a V8 engine is the torque and the power output. One of the most powerful engines with a V8 is a Dodge Challenger SRT. These engines are usually in bigger trucks and sports cars.

7 0
3 years ago
. Create an abstract Dollar class with two integer attributes, both of which are non-public (Python programmers - it is understo
aksik [14]

Answer:

Explanation:

The following code is written in Java. It creates the abstract dollar class that has two instance variables for the dollars and the coins that are passed as arguments. The test output can be seen in the picture attached below.

class Dollar {

   int dollars;

   double coin;

   private Dollar(int dollar, int coin) {

       this.dollars = dollar;

       this.coin = Double.valueOf(coin) / 100;

   }

   

}

4 0
2 years ago
In the MARS Marketing Management Simulation, the results of your marketing mix decisions:
azamat
C- are only occasionally affected by the decisions made by other teams
explanation
idk
3 0
3 years ago
Other questions:
  • What do you observe on the filter paper strip after 2 to 3 hours?
    8·2 answers
  • You just turned on a four port Ethernet switch (it hasn’t learned any addresses yet) and connected a host to each port. You send
    8·1 answer
  • If you use a surrogate key, you must ensure that the candidate key of the entity in question performs properly through the use o
    5·1 answer
  • You have found statistics on the Internet that you would like to use in your speech.
    6·1 answer
  • Wireless attacks avoid the access points to limit detection. <br> a. True <br> b. False
    9·1 answer
  • How can you troubleshoot Internet access problems?
    11·1 answer
  • Is virtualization self monitoring
    6·1 answer
  • What type of code do computers typically use to operate? A. CSS B. HTML 5 C. HTML D. Binary
    12·2 answers
  • write an assembly program that uses the output compare function of a timer to toggle an led every second
    6·1 answer
  • Another word for asking a question of your data is to _____ it.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!