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
Romashka [77]
3 years ago
15

What is the output of the following C++ program?

Computers and Technology
1 answer:
KIM [24]3 years ago
3 0

Answer:

Output:<em> </em><em>15 11/16 inches</em>

Explanation:

#include <iostream>

using namespace std;

////////////////////////////////////////////////////////////////////////

class InchSize {

public:

   InchSize(int wholeInches = 0, int sixteenths = 0);

   void Print() const;

   InchSize operator+(InchSize rhs);

   

private:

   int inches;

   int sixteenths;

};

InchSize InchSize::operator+(InchSize rhs) {

   InchSize totalSize;

   totalSize.inches = inches + rhs.inches;

   totalSize.sixteenths = sixteenths + rhs.sixteenths;

   

   // If sixteenths is greater than an inch, carry 1 to inches.

   if (totalSize.sixteenths >= 16) {

       totalSize.inches += 1;

       totalSize.sixteenths -= 16;

   }

   return totalSize;

}

InchSize::InchSize(int wholeInches, int sixteenthsOfInch) {

   inches = wholeInches;

   sixteenths = sixteenthsOfInch;

}

void InchSize::Print() const {

   cout<<inches<<" "<<sixteenths<<"/16 inches"<<endl;

}

////////////////////////////////////////////////////////////////////////

int main() {

   InchSize size1(5, 13);

   InchSize size2(9, 14);

   InchSize sumSize;

   sumSize = size1 + size2;

   sumSize.Print();

   return 0;

}

////////////////////////////////////////////////////////////////////////

sumSize variable was printed in the end. Print() prints the calling object's inches and sixteenths variables' values.

sumSize's inches is equal to size1 plus size2's inches.

Because the sum of sixteenths was greater than 16, sumSize's sixteenth was decreased by 1 and inches was increased by 1.

You might be interested in
4.22 lab*: program: automobile service invoice(1) output a menu of automotive services and the corresponding cost of each servic
azamat

To write the code for this exercise, we must be familiar with Python's computational language.

The attachment contains the code.

As a result, the Python code can be written as follows:

0 service1 cost

0 service2 cost

print("Services at Davey's Auto Shop")

print("Oil change: $35; Tire rotation: $19; Car wash: $7; Car wax: $12;"

input = service1 ("Select first service: ")

product2 = input ("Select second service: ")

If "Oil change" is service 1, then

35 service1 cost

Tire rotation: elif service1 == true

cost1 service1 = 19

"Car wash," if service1 is true:

cost service1 = 7

"Car wax" if service1 is true:

cost service1 = 12

if (service1) == "-":

service 1 equals "No service"

0 service1 cost

When service2 equals "Oil change,"

35 service2 cost

Tire rotation: elif service2 == true

cost2 service2 = 19

"Car wash" if service2 is true:

cost2 service2 = 7

"Car wax" if service2 is true:

cost2 service2 = 12

To know more about python click on the link:

brainly.com/question/18502436

#SPJ4

8 0
1 year ago
What patterns do you find within the fractions in the inch on the ruler?
PtichkaEL [24]

Answer:

The markings on a standard ruler represent the fractions of an inch. The markings on a ruler from the start to the 1″ mark are: 1⁄16“, 1⁄8“, 3⁄16“, 1⁄4“, 5⁄16“, 3⁄8“, 7⁄16“, 1⁄2“, 9⁄16“, 5⁄8“, 11⁄16“, 3⁄4“, 13⁄16“, 7⁄8“, 15⁄16“, and 1”.

8 0
3 years ago
Motivational appeals refer to
Lesechka [4]

Answer: D) All of the given options

Explanation:

Motivational appeals refers to the an emotional nature developed to increase individual values. It is a tool of emotions which target the psychological needs. It is a visualization of someone's desire and values and method of satisfying the emotions. Motivational appeals are divided into many categories like motivation and emotions.

3 0
3 years ago
What is the answer to this question?
Ivan

5

8

<u>Explanation:</u>

<u></u>

Since the number is already defined as 5, greater_than_zero holds the value true and less_than_zero holds the value false because 5 is greater than zero and not less than 0. Since there are 4 four if conditions, only two holds true i.e the first one and the last one because the in third condition we are using and logic which needs both condition to be true to make the condition true, whereas in fourth we are using or logic which can make condition true even if one condition is true. Hence the number printed will be number and number +3.

6 0
3 years ago
PLS ANSWER ASAP I WILL GIVE BRAINLIEST
vladimir1956 [14]

Answer: 'Scope' Is <u>NOT</u> a basic programming sturtcure

Explanation: Surprisingly, it can often be broken down into <u>three simple programming structures called sequences, selections, and loops</u>. ... These come together to form the most basic instructions and algorithms for all types of software.

5 0
3 years ago
Other questions:
  • What is the argument in this function =AVERAGE(F3:F26)
    15·1 answer
  • For an external usb hard drive attached to a computer, which is more suitable: a writethrough cache or a block cache
    14·2 answers
  • In the event you get pulled over for a traffic stop, describe the situation from the police officer's perspective and list at le
    6·2 answers
  • True or false? The following deterministic finite-state automaton recognizes the set of all bit strings such that the first bit
    7·1 answer
  • What kind of software would you recommend a company use if its employees are receiving e-mails that are potentially hazardous ?
    10·1 answer
  • Which task is not possible with VLOOKUP?
    10·2 answers
  • If you see these REPORT.
    14·2 answers
  • 2. How does the internet give us the ability to communicate?
    15·1 answer
  • can you still receive messages on messenger from a person when you deleted the conversation with them? (But not blocked them)
    14·2 answers
  • Discussion Topic:
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!