#include <iostream>
using namespace std;

class Product {
public:
    // Constructors
    Product();
    Product(string newName);
    Product(string newName, double newPrice);
    // Member functions
    string getName() { return name; }
    double getPrice() { return price; }
    void setName(string newName);
    void setPrice(double newPrice);
    void show();
private:
    // Member variables
    string name;
    double price;
};

// no-parameter constructor
Product::Product() {
    name = "Unknown";
    price = 0.0;
}

Product::Product(string newName) {
    setName(newName);
    price = 0.0;
}

Product::Product(string newName, double newPrice) {
    setName(newName);
    setPrice(newPrice);
}

void Product::setName(string newName) {
    if (newName.length() == 0) {
        name = "Unknown";
    } else {
        name = newName;
    }
}

void Product::setPrice(double newPrice) {
    if (newPrice > 0.0) {
        price = newPrice;
    } else {
        price = 0.0;
    }
}

void Product::show() {
    cout <<  name << " has a price of $"
         << price << endl;
}

