Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Resolve the errors C++ // Debug 11-1 // Function template finds half of an object #include #include using namespace std; template double half(int x) {

Resolve the errors C++

// Debug 11-1 // Function template finds half of an object #include #include using namespace std; template double half(int x) { double h = x / 2; return h; } class TuitionBill { friend ostream& operator<<(ostream, TuitionBill); private: string student; double amount; public: TuitionBill(string, double); double operator/(int); }; TuitionBill::TuitionBill(string student, double amt) { student = student; amount = amt; } double TuitionBill::operator/(int factor) { double half = amount / factor; return hafl; } ostream& operator<<(ostream& o, TuitionBill) { o << t.student << " Tuition: $" << t.amount << endl; return o; } int main() { int a = 47; double b = 39.25; TuitionBill tb("Smith", 4000.00); cout << "Half of " << a << " is " << half(a) << endl; cout << "Half of " << b << " is " << half(b) << endl; cout << "Half of " << tb << " is " << half(tb) << endl; return 0; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Relational Database Design With Microcomputer Applications

Authors: Glenn A. Jackson

1st Edition

0137718411, 978-0137718412

More Books

Students also viewed these Databases questions