I am totally lost. The assignment is mentioned below after the quotes.
This is all I can come up with:
#!/usr/local/bin/python3
class Student:
def __init__(self, name):
self.name = name
# self.address = address
# self.city = city
# self.state = state
# self.zip = zip
# self.gender = gender
# self.studentid = studentid
# self.gpa = gpa
def std1(self):
std1 = Student()
#std2 = Student()
#std3 = Student()
self.name = input("Enter: ")
return(self.name)
print(Student(std1.name))
I have been editing as I have been trying various troublshooting so it's a bit of a mess. any help will do.
"""""""
In this lab you will write an object specification into a program, and customize
its data fields. You will declare objects using the object specification, and assign values to its data fields.
You will also use an object as an input parameter in a function call, and as an
output parameter, too.
Requirements: Write a program that
(1) Creates an object specification with these eight data fields: name, address, city, state, zip, gender, student id, and gpa.
(2) Declare 3 uninitialized, individual student objects.
(3) Write a value-returning function to create a return a single student object. Design prompts for the user that takes input in the function for the eight data fields. Call the function three times -- once to initialize each student object.
(4) Write a function that does not return any value that outputs each student object. Call the function three times -- once for each student object.
Program I/O -- Input from the keyboard the personal information of 3 students, one student at a time. Output a summary for each of the 3 students that contains the personal information entered for each student.
Example -- Your program I/O should look something like this, with the user input in bold text and the program output in normal text (note: you do not have to make the user input in bold text, it is just shown here in bold to demonstrate what the user could type):
Enter for Student 1
name: Xio Chen
address: 123 Happy Street
city: Happytown
state: CA
zip: 12345
gender: female
student id: abc123
gpa: 4.0
Enter for Student 2
name: Carlos Ortega
address: 456 Happy Street
city: Gladtown
state: CA
zip: 54321
gender: male
student id: abc123
gpa: 4.0
...
etc,
Output for Student 1:
Name: Xio Chen
Address: 123 Happy Street
...
etc.
Output for Student 2:
Name: Carlos Ortega
Address: 456 Happy Street
...
etc.
This is all I can come up with:
#!/usr/local/bin/python3
class Student:
def __init__(self, name):
self.name = name
# self.address = address
# self.city = city
# self.state = state
# self.zip = zip
# self.gender = gender
# self.studentid = studentid
# self.gpa = gpa
def std1(self):
std1 = Student()
#std2 = Student()
#std3 = Student()
self.name = input("Enter: ")
return(self.name)
print(Student(std1.name))
I have been editing as I have been trying various troublshooting so it's a bit of a mess. any help will do.
"""""""
In this lab you will write an object specification into a program, and customize
its data fields. You will declare objects using the object specification, and assign values to its data fields.
You will also use an object as an input parameter in a function call, and as an
output parameter, too.
Requirements: Write a program that
(1) Creates an object specification with these eight data fields: name, address, city, state, zip, gender, student id, and gpa.
(2) Declare 3 uninitialized, individual student objects.
(3) Write a value-returning function to create a return a single student object. Design prompts for the user that takes input in the function for the eight data fields. Call the function three times -- once to initialize each student object.
(4) Write a function that does not return any value that outputs each student object. Call the function three times -- once for each student object.
Program I/O -- Input from the keyboard the personal information of 3 students, one student at a time. Output a summary for each of the 3 students that contains the personal information entered for each student.
Example -- Your program I/O should look something like this, with the user input in bold text and the program output in normal text (note: you do not have to make the user input in bold text, it is just shown here in bold to demonstrate what the user could type):
Enter for Student 1
name: Xio Chen
address: 123 Happy Street
city: Happytown
state: CA
zip: 12345
gender: female
student id: abc123
gpa: 4.0
Enter for Student 2
name: Carlos Ortega
address: 456 Happy Street
city: Gladtown
state: CA
zip: 54321
gender: male
student id: abc123
gpa: 4.0
...
etc,
Output for Student 1:
Name: Xio Chen
Address: 123 Happy Street
...
etc.
Output for Student 2:
Name: Carlos Ortega
Address: 456 Happy Street
...
etc.