Computers and Technology
Computers and Technology, 25.02.2021 17:50, yorylee

Type the program's output// "New" means new compared to previous level#include using namespace std;class InchSize {public:InchSize(int wholeInches = 0, int sixteenths = 0);void Print() const;InchSize operator+(InchSize rhs);InchSize operator+(int sixteenthsOfInch);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;}// New: Overloaded + operator adding integers. InchSize InchSize::operator+(int sixteenthsOfInch) {InchSize totalSize;totalSize. inches = inches;totalSize. sixteenths = sixteenths + sixteenthsOfInch;// While sixteenths is greater than an inch, carry to inches. while (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(4, 13);InchSize size2(3, 11);InchSize sumSize;InchSize totalSize;sumSize = size1 + size2;totalSize = sumSize + 18;totalSize. Print();return 0; }

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 19:20, mahaleyrenee1195
How might the success of your campaign be affected if you haven’t carefully completed all field data or if you accidentally insert the wrong merge field in the document?
Answers: 2
image
Computers and Technology, 23.06.2019 06:00, Disd112984
Which statement is true of web-based social media? a. they allow consumers to interact with and update content. b. they cannot be updated easily, as compared to print media. c. they are expensive to produce and maintain, as compared to print and television. d. they can exist independent of the internet.
Answers: 1
image
Computers and Technology, 23.06.2019 20:00, noah12345678
What multimedia system creates an immersive, real-life experience that the user can interact with?
Answers: 1
image
Computers and Technology, 24.06.2019 04:30, BobBball9126
How do you share someone else’s tweet with your own twitter followers?
Answers: 1
Do you know the correct answer?
Type the program's output// "New" means new compared to previous level#include using namespace std;c...

Questions in other subjects:

Konu
English, 11.03.2021 23:50
Konu
Mathematics, 11.03.2021 23:50
Konu
Chemistry, 11.03.2021 23:50
Konu
Mathematics, 11.03.2021 23:50