Create functions to test the validity of month, day, year, and store these in a separate file called modVerifyDate: isValidMonth                isValidDay                isValidYear               HINT:  for testing the day, this method of the CALENDAR module will be useful:                monthrange(year, month)  Returns weekday of first day of the month and number of days in month, for the specified year and month. Create an employee class The requirements for the class are as follows: Must have at least 4 private attributes/characteristics – one must be an object of type date Must have getter methods for each of the attributes Must have setter methods for each of the attributes Must have an str method to print the object with appropriate labels for each attribute Must have a constructor (  __init__) Must have a method which calculates using date objects If your class is about employees, calculate the number of years worked given the startDate.   Store this in a SEPARATE file called modEmployee.py  Test the class – put this is a SEPARATE file called   testEmployee.py Example of a test program that THOROUGHLY tests ALL of the methods for a Room class NOTE – you may NOT use Room for this! from modRoom import Room   r1 = Room("BR160",50,100 ) print("Room 1: ", r1) print("Testing getters for Room 1") idNum = r1.getRmID(); print("ID Number: ", idNum) rmLength = r1.getRmLength(); print("Length ", rmLength) rmWidth = r1.getRmWidth(); print("Width ", rmWidth) rmArea = r1.calcRmArea(); print("Area: ", rmArea)   r2 = Room("LI 300", 20, 40) print("\n\nRoom 2: ", r2) print("\nTesting setters for Room 2") r2.setRmID("Hagen123") r2.setRmLength(300);   r2.setRmWidth(150) print("Changing r2’s info to Hagen 123, Length 300, Width 150") print(r2)   Add the following to the program: #ask the user to enter information for each of the attributes of your class. #ask the user to enter the information related to the date attribute for your class: #Ask the user to enter the year – check for validity #Ask the user to enter the month  – check for validity #Ask the user to enter the day – check for validity using  the monthrange method #create a new object of your class #print the object

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
  • Create functions to test the validity of month, day, year, and store these in a separate file called modVerifyDate:
    isValidMonth
                   isValidDay
                   isValidYear

                  HINT:  for testing the day, this method of the CALENDAR module will be useful:
                   monthrange(yearmonth)

 Returns weekday of first day of the month and number of days in month, for the specified year and month.

Create an employee class

  • The requirements for the class are as follows:
  • Must have at least 4 private attributes/characteristics – one must be an object of type date
  • Must have getter methods for each of the attributes
  • Must have setter methods for each of the attributes
  • Must have an str method to print the object with appropriate labels for each attribute
  • Must have a constructor (  __init__)

Must have a method which calculates using date objects

If your class is about employees, calculate the number of years worked given the startDate.  

Store this in a SEPARATE file called modEmployee.py 

Test the class – put this is a SEPARATE file called   testEmployee.py

  • Example of a test program that THOROUGHLY tests ALL of the methods for a Room class
    NOTE – you may NOT use Room for this!

from modRoom import Room

 

r1 = Room("BR160",50,100 )

print("Room 1: ", r1)

print("Testing getters for Room 1")

idNum = r1.getRmID(); print("ID Number: ", idNum)

rmLength = r1.getRmLength(); print("Length ", rmLength)

rmWidth = r1.getRmWidth(); print("Width ", rmWidth)

rmArea = r1.calcRmArea(); print("Area: ", rmArea)

 

r2 = Room("LI 300", 20, 40)

print("\n\nRoom 2: ", r2)

print("\nTesting setters for Room 2")

r2.setRmID("Hagen123")

r2.setRmLength(300);   r2.setRmWidth(150)

print("Changing r2’s info to Hagen 123, Length 300, Width 150")

print(r2)

 

  • Add the following to the program:

#ask the user to enter information for each of the attributes of your class.
#ask the user to enter the information related to the date attribute for your class:

#Ask the user to enter the year – check for validity
#Ask the user to enter the month  – check for validity
#Ask the user to enter the day – check for validity using  the monthrange method

#create a new object of your class
#print the object

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 7 images

Blurred answer
Knowledge Booster
Introduction to Template
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education