I just signed up to ask...How would I store the information from my code(see below) into a object? I'll be naming the object employees.
The code I have now executes this:(please tell me if there are any mistakes on the code I have so far)
1.Ask the user to enter payroll information for the company. Set up a loop that continues to ask for information until the user enters “DONE”. For each employee ask three questions:
name (first & last name together as a single response)
hours worked this week (only allow 1 through 60)
hourly wage (only allow 6.00 through 20.00)
***Now this is where I get confused on structure and so on:
2.Create an EMPLOYEE object that will store the name, hours worked, and hourly wage. After the 3 items of information have been entered for an employee, use a method of the EMPLOYEE object to print the name, hours worked, and hourly wage. Setup properties for the name, hourly wage, and hours worked. Create a method that will calculate the employee’s pay (as a private attribute). Create a property for the employee’s pay. Add to a list only the pay for each employee.
Weekly pay is calculated:
For (1-40 hours) it is hourly rate * hours worked
For (41-60 hours) it is (hours worked – 40) * (hourly rate * 1.5)
+ (hourly rate * 40)
***helping in code would be appreciated!
This is what I have for number one:
import sys while True: name=raw_input('Enter a name:') if name == 'DONE': break hours=raw_input('Hours worked:') if hours == 'DONE': break else: while int(hours) > 60 or int(hours) < 1: hours=raw_input('Hours worked:') if hours == 'DONE': sys.exit(0) hwage=raw_input('Enter hourly wage:') if hwage == 'DONE': break else: while int(hwage) > 20 or int(hwage) < 5: hwage=raw_input('Enter hourly wage:') if hwage == 'DONE': sys.exit(0)
for indentation: http://pastebin.com/zjtpVAyx
I appreciate your help.
Can't rescue your code, it's totally missing proper Python indentations
In the future, please use code tags with your code to preserve the indentations. Otherwise the code is very difficult to read and not too many folks will help.
your Python code here