subject
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; }

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 11:50
You have written, as part of a school assignment, a research paper on the solar system. you want to share this paper on your school website. on which type of server will you upload it?
Answers: 1
question
Computers and Technology, 23.06.2019 00:30
Pl i need the answer now ! which one of the following is considered a peripheral? a software b mouse c usb connector d motherboard
Answers: 1
question
Computers and Technology, 23.06.2019 19:30
You can apply several different worksheet themes from which tab?
Answers: 1
question
Computers and Technology, 24.06.2019 10:20
Identify the publisher in this citation: carter,alan.a guide to entrepreneurship.new york: river’2008.print.
Answers: 3
You know the right answer?
Type the program's output// "New" means new compared to previous level#include using namespace std;c...
Questions
question
Mathematics, 06.01.2021 20:10
question
Mathematics, 06.01.2021 20:10
question
Mathematics, 06.01.2021 20:10
question
Mathematics, 06.01.2021 20:10
question
English, 06.01.2021 20:10