Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

My paths and information are correct. Im trying to just get a series of stars ( * * * * * ) to appear infront

My paths and information are correct. Im trying to just get a series of stars (*****) to appear infront of the 4 digits of the social. It should look like *****6789.
But when I try my code breaks saying TypeError: bad operand type for unary +: 'str'
As far as I can tell this should work its worked through the rest of my code but doesnt here. Here is the section it came from.
def ShowData():
#displays information
try:
with open("C:\\Users\\CC4 STUDENT\\Desktop\\CST301_LEC_151\\Activity 5.3 Classes and Objects\\employee.dat", "rb") as file:
print("{: <20}{: <15}{: <10}{: <10}{: <10}".format("Employee Name", "ID", "Hours Worked", "Pay Rate", "Gross Pay"))
print("------------------------------------------------------------------------")
while True:
try:
obj = pickle.load(file)
print("{: <20}{: <15}{: <10}{: <10}{: <10}".format(obj.get_Fname()+""+
obj.get_Lname(),+"*****"+
obj.get_social()[5:], obj.get_hrs_worked(), obj.get_rate(), obj.get_gross()))
except EOFError:
break
except FileNotFoundError:
print("The file could not be found.")
if __name__=="__main__":
# runs the following functions
EmployeeInfo() # Input employee information
ShowData() # Display employee information

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

C++ Database Development

Authors: Al Stevens

1st Edition

1558283579, 978-1558283572

More Books

Students also viewed these Databases questions