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
Provide a status report to your classmates and instructor. Describe any modifications that you have made to the design or docume
Pavel [41]

Answer:

that's muddled up I can't make out the question

3 0
3 years ago
In this lab, you will build a system for package delivery services that provides different shipping options with specific price.
Alex73 [517]

Answer:

See explaination

Explanation:

#include <iostream>

#include <string.h>

using namespace st d;

class Package

{

protected:

//sender properities

char sname[10],saddress[50],scity[20],sstate[20];

long int szip;

//Receiver properities

char rname[10],raddress[50],rcity[20],rstate[20];

long int rzip;

//additonal datamembers

float weight,cost;

public:

Package() //Default constructor

{

strcpy(sname,"");strcpy(saddress,"");strcpy(scity,"");

strcpy(sstate,"");szip=0;

strcpy(rname,"");strcpy(raddress,"");strcpy(rcity,"");

strcpy(rstate,"");rzip=0;

weight=cost=0;

}

Package(char sn[10],char sa[50],char sc[20],char ss[20],long int sz,char rn[10],char ra[50],char rc[20],char rs[20],long int rz,float w,float c) //Constructor with parameter

{

strcpy(sname,sn);strcpy(saddress,sa);strcpy(scity,sc); //copying each parameter value to data member

strcpy(sstate,ss);szip=0;

strcpy(rname,rn);strcpy(raddress,ra);strcpy(rcity,rc);

strcpy(rstate,rs);rzip=0;

weight=w;cost=c;

}

float calculateCost() //calculating cost

{

return weight*cost;

}

};

class TwoDayPackage:public Package //Inheritance

{

float flatfee;

public:

TwoDayPackage(char sn[10],char sa[50],char sc[20],char ss[20],long int sz,char rn[10],char ra[50],char rc[20],char rs[20],long int rz,float w,float c,float ff) //Constructor with parameter

{

Package(sn,sa,sc,ss,sz,rn,ra,rc,rs,rz,w,c); //calling super class constructor

flatfee=ff; //copy last parameter

}

float calculateCost() //redefined calculateCost function

{

return (weight*cost)+flatfee; //return total cost

}

};

class OverNightPackage:public Package //Inheritance

{

float addfee;

public:

OverNightPackage(char sn[10],char sa[50],char sc[20],char ss[20],long int sz,char rn[10],char ra[50],char rc[20],char rs[20],long int rz,float w,float c,float a f) //constructor with parameter

{

Package(sn,sa,sc,ss,sz,rn,ra,rc,rs,rz,w,c); //calling super class constructor

addfee=a f; //copy last parameter

}

float calculateCost() //redefined calculateCost function

{

return (weight*cost)+addfee; //calculating total cost

}

};

int main()

{

Package package1("lou brown","1 main st","boston","ma",11111,"mary smith","7 elm st","new york","ny",22222,8.5,0.5); //creating objects

TwoDayPackage package2("lisa klein", "5 broadway", "somerville", "ma", 33333, "bob george", "21 pine rd", "cambridge", "ma", 44444, 10.5, .65, 2.0 );

OverNightPackage package3 ("ed lewis", "2 oak st", "boston", "ma", 55555, "don kelly", "9 main st", "denver", "co", 66666, 12.25, .7, .25 );

cout<<"\nPackage Cost : "<<package1.calculateCost(); //calling each cost

cout<<"\nTwoDay Package Cost : "<<package2.calculateCost();

cout<<"\nOvernight Package Cost : "<<package3.calculateCost();

return 0;

}

8 0
3 years ago
A group of Automation Anywhere Enterprise users are required to automate bots for a customer change requirement. The users find
stich3 [128]

There are a number of tools that have emerged since Automation was born. One such tool is the Automation Anywhere. It is a good example of an RPA tool that is used to automate various tasks and upload task bots. Automation Anywhere is made up of three main components. These components include Bot Creators, Bot Runners, and Control Room.

Further explanation

To answer the question, it is most likely that these users have a Community edition which does not allow them to upload bots to the control room. It is also most likely that the users are running a developer license and not a runner (Enterprise) license. Whether or not this is the case, the administrator needs to assign them an administrator role and not a developer one which I assume they are using

Community edition helps users interact with the most basic features of the tool before they are comfortable enough to upgrade to the Enterprise version. These users are able to automate bots for customers only if they have the Administrator role option. The Administration option is found on the Enterprise edition only and not the community edition.

Learn more about

brainly.com/question/11317405

brainly.com/question/11317405

#LearnWithBrainly

6 0
2 years ago
Will somebody please explain to me HTML?
larisa86 [58]

Answer:

Hypertext Markup Language (is also known as html) is the standard markup language for creating web pages and web applications.

3 0
3 years ago
Write the half function. A function call and the functionprototype
EastWind [94]

Answer:

C code for half()

#include<stdio.h>

void half(float *pv);

int main()

{

float value=5.0;  //value is initialized  

printf ("Value before half: %4.1f\n", value); // Prints 5.0

half(&value);  // the function call takes the address of the variable.

printf("Value after half: %4.1f\n", value); // Prints 2.5

}

void half(float *pv) //In function definition pointer pv will hold the address of variable passed.

{

*pv=*pv/2;  //pointer value is accessed through * operator.

}

  • This method is called call-by-reference method.
  • Here when we call a function, we pass the address of the variable instead of passing the value of the variable.
  • The address of “value” is passed from the “half” function within main(), then in called “half” function we store the address in float pointer ‘pv.’ Now inside the half(),  we can manipulate the value pointed by pointer ‘pv’. That will reflect in the main().
  • Inside half() we write *pv=*pv/2, which means the value of variable pointed by ‘pv’ will be the half of its value, so after returning from half function value of variable “value” inside main will be 2.5.

Output:

Output is given as image.

3 0
3 years ago
Other questions:
  • Write a class named RetailItem that holds data about an item in a retail store. The class should store the following data in att
    15·1 answer
  • What is the maximum upload speed you can get on an isdl internet connection?
    9·1 answer
  • New Jersey and New York have the highest state taxes in the United States. They also have high ratios of people moving out compa
    13·1 answer
  • In Word, a red wavy underline indicates a/an
    15·1 answer
  • Nikolas has a idea that he could use the compressed carbon dioxide in a fire extinguisher to propel him on his skateboard. Nikol
    13·2 answers
  • why are the ads you might see on tv between 8am and 10am usually not the same ads you would see between 8pm and 10pm?
    12·1 answer
  • A technician has just installed a video card in a PC. The video card is not working, althoughit was working fine on the test ben
    6·1 answer
  • What is first page of website called​
    10·1 answer
  • A ______ is a group of slides designed and formatted for a specific purpose. These include themes as well as content.
    8·1 answer
  • Is there a way for me to play a .mp3 file from my computer using Atom?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!