Looking for advice /review on my code to see if I am missing any steps from the task, missing any code or made an error, and if so what? Task found below along with my written code. (Python) #Write Here class Wages: #Declare Methods     def __init__(self, name, hours, wages):         self.name = name         self.hours = hours         self.wages = wages #Determine Name     def getName(self):         self.name = str(input("Enter employee's name: "))         return self.name #Validate Weekly Hours     def getHours(self):         while True:             try:                 self.hours = int(input("Enter number of hours worked: "))                 if self.hours <= 0:                     print("Value must be a number greater than 0!")                     continue             except EOFError:                 continue             else:                 return self.hours #Validte Hourly Wage     def getWage(self):         while True:             try:                 self.wages = int(input("Enter your hourly wage: "))                 if self.wages <= 0:                     print("Value must be a number greater than 0!")                     continue             except EOFError:                 continue             else:                 return self.wages #Determine Weekly Pay     def payForWeek(self):         pay = self.getWage() * self.getHours()         if self.getHours() > 40:             overtime = 40 - self.getHours()             pay += 0.5 * overtime             return pay         return pay cont = 'Y' while cont == 'Y':     weekPay = Wage()     print("This Program will create a class that stores an employees name and calculates weekly pay.")     print("You entered that " + getName() + " worked " + getHours() + " hour(s) this week.")     print("You entered that " + getName() + " earns $" + getWage() + " per hour.")     print("Pay for " + getName() + " is $" + payForWeek())     print("Do you want to run the program again? ('Y' for yes, anything else to quit)")     cont = input()

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Looking for advice /review on my code to see if I am missing any steps from the task, missing any code or made an error, and if so what?
Task found below along with my written code. (Python)
#Write Here
class Wages:
#Declare Methods
    def __init__(self, name, hours, wages):
        self.name = name
        self.hours = hours
        self.wages = wages
#Determine Name
    def getName(self):
        self.name = str(input("Enter employee's name: "))
        return self.name
#Validate Weekly Hours
    def getHours(self):
        while True:
            try:
                self.hours = int(input("Enter number of hours worked: "))
                if self.hours <= 0:
                    print("Value must be a number greater than 0!")
                    continue
            except EOFError:
                continue
            else:
                return self.hours
#Validte Hourly Wage
    def getWage(self):
        while True:
            try:
                self.wages = int(input("Enter your hourly wage: "))
                if self.wages <= 0:
                    print("Value must be a number greater than 0!")
                    continue
            except EOFError:
                continue
            else:
                return self.wages
#Determine Weekly Pay
    def payForWeek(self):
        pay = self.getWage() * self.getHours()
        if self.getHours() > 40:
            overtime = 40 - self.getHours()
            pay += 0.5 * overtime
            return pay
        return pay

cont = 'Y'
while cont == 'Y':
    weekPay = Wage()
    print("This Program will create a class that stores an employees name and calculates weekly pay.")
    print("You entered that " + getName() + " worked " + getHours() + " hour(s) this week.")
    print("You entered that " + getName() + " earns $" + getWage() + " per hour.")
    print("Pay for " + getName() + " is $" + payForWeek())
    print("Do you want to run the program again? ('Y' for yes, anything else to quit)")
    cont = input()

Exercise 1: Employee Payroll firstname_lastname_CH10PE1
Write a program that asks for an hourly worker's name, hours worked, and hourly wage, and
then calculates their weekly pay.
The program should contain a class named Wages and follow the UML below.
Wages
name
hours
wages
_init_(name, hours, wages)
getName()
getHours()
getWage()
payForWeek()*
*Hint: Use an if statement to determine if you need to calculate regular or overtime pay. Return
formatted value.
Any hours worked over 40 should calculate at time and a half. This must be calculated
in the Wages object.
You must use the Wage's class methods to return name, wage, and hour. Hint: Return
the value formatted to the main so you can use the value in a print statement.
Modify the functions you used from Chapter 9 to do input validation and your run the
program again functions. Do not recreate the wheel.
Input validation should check for numbers and non-zero values. No input validation
needs to be completed on the name.
Transcribed Image Text:Exercise 1: Employee Payroll firstname_lastname_CH10PE1 Write a program that asks for an hourly worker's name, hours worked, and hourly wage, and then calculates their weekly pay. The program should contain a class named Wages and follow the UML below. Wages name hours wages _init_(name, hours, wages) getName() getHours() getWage() payForWeek()* *Hint: Use an if statement to determine if you need to calculate regular or overtime pay. Return formatted value. Any hours worked over 40 should calculate at time and a half. This must be calculated in the Wages object. You must use the Wage's class methods to return name, wage, and hour. Hint: Return the value formatted to the main so you can use the value in a print statement. Modify the functions you used from Chapter 9 to do input validation and your run the program again functions. Do not recreate the wheel. Input validation should check for numbers and non-zero values. No input validation needs to be completed on the name.
The program will create a class that stores an employees name and calculates weekly pay
Enter employee's name: Joseph Silman
Enter number of hours worked: a
Value must be a number greater than e!
Enter number of hours worked: -1
value must be a number greater than e!
Enter number of hours: 0
Value must be a number greater than 0!
Enter number of hours: 10
Enter your hourly wage: u
Value must be a number greater than 0!
Enter your hourly wage: -1
Value must be a number greater than 0!
Enter your hourly wage: e
Value must be a number greater than e!
Enter your hourly wage: 10
You entered that Joseph Silman worked 10.00 hour(s) this week.
You entered that Joseph Silman earns $10.00 per hour.
Pay for Joseph Silman is $100.00
Do you want to run the program again? ('Y' for yes, anything else to quit)
Y
The program will create a class that stores an employees name and calculates weekly pay
Enter employee's name: Joseph Silman
Enter number of hours worked: 45
Enter your hourly wage: 10
You entered that Joseph Silman worked 45.00 hour(s) this week.
You entered that Joseph Silman earns $10.00 per hour.
Pay for Joseph Silman is $475.00
Do you want to run the program again? ('Y' for yes, anything else to quit)
Transcribed Image Text:The program will create a class that stores an employees name and calculates weekly pay Enter employee's name: Joseph Silman Enter number of hours worked: a Value must be a number greater than e! Enter number of hours worked: -1 value must be a number greater than e! Enter number of hours: 0 Value must be a number greater than 0! Enter number of hours: 10 Enter your hourly wage: u Value must be a number greater than 0! Enter your hourly wage: -1 Value must be a number greater than 0! Enter your hourly wage: e Value must be a number greater than e! Enter your hourly wage: 10 You entered that Joseph Silman worked 10.00 hour(s) this week. You entered that Joseph Silman earns $10.00 per hour. Pay for Joseph Silman is $100.00 Do you want to run the program again? ('Y' for yes, anything else to quit) Y The program will create a class that stores an employees name and calculates weekly pay Enter employee's name: Joseph Silman Enter number of hours worked: 45 Enter your hourly wage: 10 You entered that Joseph Silman worked 45.00 hour(s) this week. You entered that Joseph Silman earns $10.00 per hour. Pay for Joseph Silman is $475.00 Do you want to run the program again? ('Y' for yes, anything else to quit)
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY