Microsoft Word XXXXXXXXXXAssignment #5.doc Assignment #5 (80 Points) – COSC 4327 – Dr. Leonard Brown Due: December 7, 2019 Problem Description Although the usage of checks are declining, one aspect...

1 answer below »
There is instruction let me know the prices


Microsoft Word - 4327 Assignment #5.doc Assignment #5 (80 Points) – COSC 4327 – Dr. Leonard Brown Due: December 7, 2019 Problem Description Although the usage of checks are declining, one aspect about them presents an interesting programming problem. When completing a check, the amount is written in a box. The amount is then repeated in words on the next line. So, when people write 130.45 in the box, they also write one hundred thirty and 45/100 on the next line. See the following example: Note the following points from the above example:  The portion after the decimal is expressed as a numeric fraction with a denominator of 100  The word and is used to separate the portion after the decimal from the portion before the decimal. For this assignment, write a Python (v3) script that inputs a floating-point value representing an amount of money. (In reality, currency would not be stored using floating-point values). The script should output the value written with words as it would appear on a check. The following is an exhaustive list of the words your program may print to represent the values to the left of the decimal point. zero, one, two, three, four, five, six, seven, eight, nine, ten, eleven, twelve, thirteen, fourteen, fifteen, sixteen, seventeen, eighteen, nineteen, twenty, thirty, forty, fifty, sixty, seventy, eighty, ninety, hundred, thousand. No value about 999,999 will be given as input. No negative values will be given, either. Submission Procedure Submit your assignment as one or more text files through Canvas. Do not submit a pdf or MS word file for a script. I will test your script on an Ubuntu environment using Python v3. Sample Input 123456.78 Sample Output one hundred twenty three thousand four hundred fifty six and 78/100 Grading The script will be graded based on the following criteria Implementation of Requirements 35 points Program Works Correctly 35 points Comments 10 points Notes Points can be deducted from your assignment based on the quality of its presentation. Handwritten assignments will not be accepted.
Answered Same DayDec 06, 2021

Answer To: Microsoft Word XXXXXXXXXXAssignment #5.doc Assignment #5 (80 Points) – COSC 4327 – Dr. Leonard Brown...

Ria answered on Dec 08 2021
151 Votes
cheque.py
f=0 # flag
def convert (amount): # function for converting the amount into words
    # length of the number
    l = len(amount);
    # if
number is between one to nine
    digit1 = ["", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"]

    # if number is between ten to nineteen
    digit2 = ["", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"]
    # if numbers are multiple of ten
    x10 = ["", "", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"]
    # if numbers are power of ten
    pow10 = ["hundred", "thousand"]
    # for single digit
    if (l == 1):
        print (digit1 [ord (amount[0]) - 48], end = " ")
        if (f==1):
            print ("thousand", end = " ")
        return
    # repeat a loop for amount is not 0
    x = 0
    while (x < len(amount)):
        # for first 2 digits
        if (l == 3):
            if (ord (amount[x]) - 48 != 0):
                print (digit1 [ord (amount[x]) - 48], end = " ")
                print (pow10 [l-3], end = " ")
            l -= 1
            
        # for last 2 digits
        else:
            if (ord (amount[x]) - 48 == 1):
                sum = (ord (amount[x]) - 48 + ord (amount[x+1]) - 48);
                print (digit2[sum], end = " ")
                if (f==1):
                    print ("thousand", end = " ")
                return
            elif (ord (amount[x]) - 48 == 2 and ord (amount[x+1]) - 48 == 0):
                print ("twenty")
                return
            # 21 to 99
            else:
                i = ord (amount[x]) - 48
                if (i > 0):
                    print (x10[i], end =...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here