$18.99
The aim of this lab class is to implement three classes. This will help us understand how classes can be used to model the real world.
TASK 1:
Declare and implement a class named Circle. Each Circle object should have radius and pi (declared as a constant) as data members. Include a default constructor that sets the radius to 0.0, a set function that takes as arguments the value for the radius of a circle, a function that returns the radius, a function that calculates and returns the area of the circle, a function that calculates and return the diameter of the circle, and a function that calculates and returns the circumference of the circle.
Place your class declaration in Circle.h and the implementations in Circle.cpp.
Implement a driver program that instantiates two Circle objects. Prompt the user to enter values for both objects and display all their information.
TASK 2:
Write a class named RetailItem that holds data about an item in a retail shop. The class should have the following data members:
§ Item id
§ Description
§ Units on hand
§ Price per item
Write a non-default constructor (initialization constructor) that accepts arguments for each data member, a function that accepts arguments to set the data member values, a function that will display an item’s information, and a function named sold() that will receive a parameter representing a quantity sold. The function sold() should reduce the units on hand (if available) depending on the quantity sold and display the total price for the sold item. If the units on hand are not sufficient, do not deduct the quantity and display a message indicating it is out of stock.
Use appropriate interface and implementation file for your code. Write a driver program that creates a RetailItem object. Then provide three options to the user – change the item’s information, display the item’s information, or sell the item. To sell the item, prompt the user to enter the quantity.