

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Notes; Professor: Ehlmann; Class: Introduction to Computing for Engineers; Subject: Computer Science; University: Southern Illinois University Edwardsville; Term: Unknown 1989;
Typology: Study notes
1 / 3
This page cannot be seen from the preview
Don't miss anything!


#include
friend istream& operator>> ( istream&, Drill& ); friend ostream& operator<< ( ostream&, const Drill& ); Why const? }; // class drill // Function and operator member (method) definitions: Drill :: Drill(double d, double f, double s) { diameter = d; feed = f; speed = s; } double Drill :: mrr() const { return (PI * 0.25 * diameter * diameter * feed * speed / 60.0); } double Drill :: torque(double unitPower) const { double radSec; // rotational speed in radians per second radSec = speed * 2 * PI / 60.0; return (unitPower * mrr() / radSec); } // Definitions of friend operators. istream& operator>> ( istream& is, Drill& dr ) // Extract from input stream is the three components of the Drill object dr // returning the updated input stream. { is >> dr.diameter >> dr.feed >> dr.speed; return is; } ostream& operator<< ( ostream& os, const Drill& dr ) // Display to the output scream os the drill object dr labeling all // components and returning the updated output stream. { os << "Drill " << endl << " diameter: " << dr.diameter << " mm" << endl << " feed: " << dr.feed << " mm/rev" << endl << " speed: " << dr.speed << " rpm" << endl; return os; } // // Driver to declare and manipulate a drill object // int main()