Question

In: Computer Science

Must be in python The ISO 8601 Standard date format for Information Interchange indicates that a...

Must be in python

The ISO 8601 Standard date format for Information Interchange indicates that a date be written as such:

yyyy-MM-dd (eg. 2012-07-02, 1999-12-05, 1998 -01-27 )   

where yyyy represents the four digit year

MM represents a two digit numerical month

dd represents a two digit numerical day

Chinese date format is specified as: yyyy-M-d

Macedonean date format is specified as: d.M.yyyy.

where yyyy represents the four digit year

M represents a one or two digit numerical month, as appropriate

d represents a one or two digit numerical day, as appropriate

You are to write a program which converts dates from Chinese and Macedonean formats to ISO format. The program will repeat the following until the user wishes to exit:

* ask the user which format they will be entering (C - Chinese or M-Macedonean)

* accept the user input

* output the ISO version of the date that was input

Your program should handle user input errors such as:

* leading blanks

* blanks within the input string

Your program should delegate any large operations to functions which should be DEFINED AN IMPORTED MODULE, for example month conversion to mFormat, MMformat.

Solutions

Expert Solution

KEYNOTES:-

  1. USE ONLY CAPITAL LETTERS TO GIVE USER INPUTS IN YOUR PROGRAM.
  2. USE "C" TO ENTER DATE IN CHINESE.
  3. USE "M" TO ENTER DATE IN MACEDONIAN.
  4. USE "E" TO EXIT THE PROGRAM.
  5. I HAVE PRINTED MANY STATEMENTS IN THE OUTPUT SCREEN TO PROVIDE YOU A GOOD INTERFACE WITH THE PROGRAM.
  6. I HAVE ONLY IMPORTED THE DATETIME MODULE IN THIS PROGRAM TO MAP DAY, MONTH, AND YEAR WITH DATE.
  7. STILL, IF YOU HAVE AND DOUBTS AND QUERIES YOU CAN COMMENT AND ASK ME.

PROGRAM: -

OUTPUT: -

PROGRAM CODE:-

import datetime
ch='\O'
while(ch!='E'):
print("\nPRESS C TO ENTER THE CHINESE DATE FORMAT")
print("PRESS M TO ENTER THE MACEDONEAN DATE FORMAT")
print("PRESS E TO EXIT",)
ch=input("ENTER YOUR CHOICE : ")
  
if(ch=='C'):
print("\n**YOUR HAVE SELECTED TO ENTER YOUR DATE IN CHINESE FORMAT**")
year = int(input('ENTER THE YEAR : '))
month = int(input('ENTER THE MONTH : '))
day = int(input('ENTER THE DAY : '))
date1 = datetime.date(year, month, day)
print("\nYOUR ENTERED DATE IN CHINESE FORMAT IS :",year,end="-")
print(month,end="-")
print(day)
print("THE ISO VERSION OF THIS DATE IS :",date1)
elif(ch=='M'):
print("\n**YOUR HAVE SELECTED TO ENTER YOUR DATE IN MACEDONEAN FORMAT**")
day = int(input('ENTER THE DAY : '))
month = int(input('ENTER THE MONTH : '))
year = int(input('ENTER THE YEAR : '))
date1 = datetime.date(year, month, day)
print("\nYOUR ENTERED DATE IN MACEDONEAN FORMAT IS :",day,end=".")
print(month,end=".")
print(year)
print("THE ISO VERSION OF DATE IS :",date1)
elif(ch=='E'):
print("\n**THANKYOU**")


Related Solutions

PERFORM an internet search to find more information about ISO 14000. DESCRIBE the components of ISO...
PERFORM an internet search to find more information about ISO 14000. DESCRIBE the components of ISO 14000. What is it? What is the history? What do some of the standards talk about?
ISO/IEC 27005 - Description of the standard (What does it cover?) The intent of standard (How...
ISO/IEC 27005 - Description of the standard (What does it cover?) The intent of standard (How does it address what it intends to cover?) How would this standard be applied in a mid-sized organization?
Describe the four major phases of the ISO LCA Standard: Name and describe in a few...
Describe the four major phases of the ISO LCA Standard: Name and describe in a few sentences each of the four major phases found in the ISO LCA standard.
Python: What are the defintions of the three method below for a class Date? class Date(object):...
Python: What are the defintions of the three method below for a class Date? class Date(object): "Represents a Calendar date"    def __init__(self, day=0, month=0, year=0): "Initialize" pass def __str__(self): "Return a printable string representing the date: m/d/y" pass    def before(self, other): "Is this date before that?"
Project flow and Report Format The following information must be included in your report: Abstract Table...
Project flow and Report Format The following information must be included in your report: Abstract Table of Content List of Figures List of Tables LIST OF ABBREVIATIONS Part 1: Introduction Part 2: Literature Review Part 3: Methodology Part 4: Result and Discussion Part 5: Conclusions Part 6: References Appendix
Depreciation must be recorded for the year given the following information: Assets Acquisition Date Cost Estimated...
Depreciation must be recorded for the year given the following information: Assets Acquisition Date Cost Estimated Life Salvage Depreciation Method Building 7/1/08 $306,000 25 years $20,000 straight-line Star ship #1 4/1/09 $28,000 60,000 parsecs $3,100 units of production (parsecs) (7,000 parsecs this yr.) Star ship #2 9/1/11 $33,000 60,000 parsecs $4,200 units of production (parsecs) (6,000 parsecs this yr.) Star Destroyer #2 3/29/09 $40,000 10 years $5,000 straight-line Star Destroyer #3 9/16/10 $43,000 10 years $5,500 straight-line Office Equipment 11/15/09...
I have a table of bike riders in the following format: Bike_number, Start_date(date and time), End_date(date,...
I have a table of bike riders in the following format: Bike_number, Start_date(date and time), End_date(date, time) I also have a table of temperatures per hour Using sql: how do I calculate Count/min/max/average of riders as compared to the temperature at the hour
FASB and IASB recently delayed the effective date of their revenue standard. 1. What new information...
FASB and IASB recently delayed the effective date of their revenue standard. 1. What new information is available regarding FASB's and/or IASB's progress toward addressing the underlying reason that prompted the delay? 2.How prevalent is sustainability reporting in (a) the U.S. and (b) globally? In citing specific statistics, indicate the size of the company to which the information pertains. 3. What standards or guidelines should accounting professionals involved in sustainability reporting be familiar with?
Imagine that you are the Information Security Officer (ISO) of your organization. Develop a plan to...
Imagine that you are the Information Security Officer (ISO) of your organization. Develop a plan to conduct a Web application penetration test on your network. Identify and explain all steps necessary to successfully complete the test.
Write a Java console application that reads a string for a date in the U.S. format...
Write a Java console application that reads a string for a date in the U.S. format MM/DD/YYYY and displays it in the European format DD.MM.YYYY  For example, if the input is 02/08/2017, your program should output 08.02.2017
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT