Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using Python: Par 1. You will define Student class with the following attributes: CWID: the students CWID FirstName: the students first name LastName: the students

Using Python:

Par 1.

You will define Student class with the following attributes:

  • CWID: the students CWID
  • FirstName: the students first name
  • LastName: the students last name
  • Gender: the students gender (M or F)
  • BirthDate: the students date of birth (e.g. 03/14/1999)
  • ClassID: the class id that the student took
  • ClassDate: the date when the student took the class (e.g. 01/26/2018)
  • Grade: the students grade for the class

In addition, you will do the following tasks:

  1. Implement a set of setter/getter methods and properties (defined via property() built-in function) which can be used to access the above attributes
  2. Implement a constructor which takes the following string (the format defined in HW assignment #1) as the input parameter:
    1. CWID:3472634, FirstName:John, , Grade:3.7
  3. Implement a method named output which uses str.format() to generate a string according to the following format specification (attributes, and the output ordering and output format of each attribute). The method also returns the generated string.

Attribute

Width

Alignment

1

CWID

12

Center

2

FirstName

15

Left justified

3

LastName

10

Left justified

4

ClassID

9

Center

5

Grade

5

Right justified

Part 2.

Implement Python function according to the following requirements:

  • The function takes an input parameter defining the name of a file in which every record defines data for one student and has the layout defined in above task 2.
  • For each record in the file, the function does the following:
  • Use the record to create a Student object
  • Attach the Student object into a list object
  • For each Student object, the function calls its output method defined in above task 3 to generate the formatted string and then write the string to a file the name of which is passed as the second input parameter of the function.

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

Step: 3

blur-text-image

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

Database Basics Computer EngineeringInformation Warehouse Basics From Science

Authors: Odiljon Jakbarov ,Anvarkhan Majidov

1st Edition

620675183X, 978-6206751830

More Books

Students also viewed these Databases questions

Question

A. Did you present the facts correctly?

Answered: 1 week ago