Create a project called lab3 (if using Visual Studio), and a source file called…
- User
Create a project called lab3 (if using Visual Studio), and a source file called lab3.cpp. Create a Mass class that internally stores a mass in drams1 . Create mutator member functions named setMassAvoirdupoisPounds, setMassTroyPounds, and setMassMetricGrams that take an input mass in the specified mass system, convert the mass to drams, and store that mass in the class member variable. Also, create three accessor functions that return the stored mass in each of the three systems. Write a main function to test your class. Your program should perform error checks on all inputs. Use the following equations to convert between the three mass systems: • 1 dram = 1.7718451953125 grams • 1 dram = 1/256 Avoirdupois pound2 • 1 dram = 1/96 Troy (apothecaries) pound3 The output of your program should look something like the following: Please enter 1 to use Avoirdupois pounds, 2 to use Troy pounds, 3 to use grams, or 0 to exit: 1 Please enter a mass in Avoirdupois pounds: 1 Mass in Avoirdupois pounds is 1 Mass in Troy pounds is 2.66667 Mass in grams is 453.592 Please enter 1 to use Avoirdupois pounds, 2 to use Troy pounds, 3 to use grams, or 0 to exit: 2 Please enter a mass in Troy pounds: 1 Mass in Avoirdupois pounds is 0.375 Mass in Troy pounds is 1 Mass in grams is 170.097 Please enter 1 to use Avoirdupois pounds, 2 to use Troy pounds, 3 to use grams, or 0 to exit: 3 Please enter a mass in grams: 1 Mass in Avoirdupois pounds is 0.00220462
- Assistant
Mass in Troy pounds is 0.0058 Mass in grams is 1 Please enter 1 to use Avoirdupois pounds, 2 to use Troy pounds, 3 to use grams, or 0 to exit: 0