{"id":1578,"date":"2021-02-14T00:05:21","date_gmt":"2021-02-13T16:05:21","guid":{"rendered":"http:\/\/cnliutz.uicp.io\/?p=1578"},"modified":"2021-02-14T00:05:21","modified_gmt":"2021-02-13T16:05:21","slug":"python-%e7%b1%bb%ef%bc%88class%ef%bc%89","status":"publish","type":"post","link":"http:\/\/jwvvql68.ipyingshe.net:5347\/?p=1578","title":{"rendered":"python \u7c7b\uff08class\uff09"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>class Staff:\n\n    def __init__ (self, pPosition, pName, pPay):\n        self.position = pPosition\n        self.name = pName\n        self.pay = pPay\n        print('Creating Staff object')\n    def __str__(self):\n        \n        return \"Position = %s, Name = %s, Pay = %d\" %(self.position, self.name, self.pay)\n        \n    def calculatePay(self):\n        prompt = '\\nEnter number of hours worked for %s: ' %(self.name)\n        hours = input(prompt)\n        prompt = 'Enter the hourly rate for %s: ' %(self.name)\n        hourlyRate = input(prompt)\n        self.pay = int(hours)*int(hourlyRate)\n        return self.pay\n    \nif __name__ == \"__main__\":\n    officeStaff1 = Staff('Basic', 'Yvonne', 0)\n    print(officeStaff1)\n    print(officeStaff1.calculatePay())<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"class_list":["post-1578","post","type-post","status-publish","format-standard","hentry","category-python"],"_links":{"self":[{"href":"http:\/\/jwvvql68.ipyingshe.net:5347\/index.php?rest_route=\/wp\/v2\/posts\/1578","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/jwvvql68.ipyingshe.net:5347\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/jwvvql68.ipyingshe.net:5347\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/jwvvql68.ipyingshe.net:5347\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/jwvvql68.ipyingshe.net:5347\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1578"}],"version-history":[{"count":1,"href":"http:\/\/jwvvql68.ipyingshe.net:5347\/index.php?rest_route=\/wp\/v2\/posts\/1578\/revisions"}],"predecessor-version":[{"id":1579,"href":"http:\/\/jwvvql68.ipyingshe.net:5347\/index.php?rest_route=\/wp\/v2\/posts\/1578\/revisions\/1579"}],"wp:attachment":[{"href":"http:\/\/jwvvql68.ipyingshe.net:5347\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1578"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/jwvvql68.ipyingshe.net:5347\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1578"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/jwvvql68.ipyingshe.net:5347\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1578"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}