Fill This Form To Receive Instant Help

Help in Homework
trustpilot ratings
google ratings


Homework answers / question archive / The questions must be answered in the context of object oriented programming or functional programming

The questions must be answered in the context of object oriented programming or functional programming

Computer Science

The questions must be answered in the context of object oriented programming or functional programming.

Submit complete Python codes for Questions 1-4.

 

Question 1 (20 points)

  1. Sensitive information is often removed, or redacted, from documents before they are released to the public. When the documents are released, it is common for the redacted text to be replaced with black bars. In this question, you will write a program that redacts all occurrences of sensitive words in a text file by replacing them with asterisks. Your program should redact sensitive words wherever they occur, even if they occur in the middle of another word. The list of sensitive words will be provided in a separate text file. Save the redacted version of the original text in a new file. The names of the original text file, sensitive words file, and redacted file will all be provided by the user.

 

  1. Extend your program so that it redacts words in a case insensitive manner. For example, if exam appears in the list of sensitive words, then redact exam, Exam, ExaM and EXAM, among other possible capitalizations.

 

*** Note that your program should perform error checking.

*** You may find the replace method for string helpful for this question. Information about the replace method can be found on the Internet.

             

Question 2 (20 points)

A magic date is a date where the day multiplied by the month is equal to the two-digit year. For example, June 10, 1960 is a magic date because June is the sixth month, and 6 times 10 is 60, which is equal to the two-digit year. 

  1. Write a function named isMagicDate that determines whether or not a date is a magic date. 
  2. Use your function to create a main program that finds and displays all the magic dates in the 20th century.

 

In this question, you may need to have another function named daysInMonth that will take two parameters: (1) The month as an integer between 1 and 12, and (2) the year as a four digit integer and determines how many days there are in a particular month. Ensure that your function reports the correct number of days in “February” for Leap Years.

 

Note

Most years have 365 days. However, the time required for the Earth to orbit the Sun is actually slightly more than that. As a result, an extra day, February 29, is included in some years to correct for this difference. Such years are referred to as leap years. The rules for determining whether or not a year is a leap year follow:

? Any year that is divisible by 400 is a leap year.

? Of the remaining years, any year that is divisible by 100 is not a leap year.

? Of the remaining years, any year that is divisible by 4 is a leap year. ? All other years are not leap years.

             

Option 1

Low Cost Option
Download this past answer in few clicks

18.99 USD

PURCHASE SOLUTION

Already member?


Option 2

Custom new solution created by our subject matter experts

GET A QUOTE