Assignment Content 20222 CSCI6163 Lab Assignment 2: Function and Module In this lab assignment, you are required to enhance the Simple Interest Program from the lab 1. After coding, you should test...


Assignment Content




  1. 20222 CSCI6163 Lab Assignment 2: Function and Module






    In this lab assignment, you are required to enhance the Simple Interest Program from the lab 1.






    After coding, you should test your program to make sure your code runs without errors.


    You may use the following scenario to test your code. You should save your test result and submit it.













    This Find Simple Interest application will ask user to specify


    the amount of a loan, an interest rate, and the number of years.


    The application calculates and display the simple interest for the


    given loan at the specified interest for a specified number of years.






    Please enter the amount of loan:
    enter a negative number


    Entry must be an integer greater than 0 Please try again.


    Please enter the amount of loan:
    enter a positive number


    Please enter the interest rate:
    enter a negative number


    Entry must be a floating number greater than 0.0 Please try again.


    Please enter the interest rate:
    enter a positive number


    Please enter the number of years:
    enter a negative number


    Entry must be an integer greater than 0 Please try again.


    Please enter the number of years:
    enter a positive number


    The interest on a loan of $___ at _.__% interest rate for __ years


    is $___.


    Do you want to do another calculation? (y for yes)
    enter y


    Please enter the amount of loan:
    enter a positive number


    Please enter the interest rate:
    enter a positive number


    Please enter the number of years:
    enter a positive number


    The interest on a loan of $___ at _.__% interest rate for __ years


    is $___.


    Do you want to do another calculation? (y for yes)n


    Done!








    Requirements


    1.Re-organize the code into the following four functions, and save the source code in a Python file called lab2a.py.



    • get_float(prompt, low, )

    • get_int(prompt, low)

    • calculate_simple_interest(principle, interest_rate, years=1)

    • main()


    Please define a default value of 1 for the argument years in the calculate_simpe_interest() function.


    Test your source code in lab2.py file using the same inputs you entered for requirement 1, you should get the same output shown in the requirement 1.






    2.Re-organize the code from requirement 2 into the following 2 Python files, lab2getnumber.py, lab2b.py.


    The following functions are in the lab2getnumber.py file:



    • get_float(prompt, low)

    • get_int(prompt, low)

    • main()


    The following functions are in the lab2b.py file:



    • calculate_simple_interest(principle, interest_rate, years=1)

    • main()


    Test your source code in lab2b.py file using the same inputs you entered for requirement 1, you should get the same output shown in the requirement 1.










    Since each assignment is designed to test specific skills.
    Please use the skills that are covered in the class so far. For example,



    • Please do not use f-string or format() method to format the strings in this assignment.







    Please DO NOT attach any compressed file. Students will be responsible for the late submission if we receive your uncompressed file after the deadline.


    Please attach


    1. your Python source code .py files


    2. the result of running your program. For example, a screenshot






































































    Total Points



    100



    1



    Upload lab2a.py file



    10








    Organized code in 4 functions



    20








    Upload the test result



    10








    Correct source code



    10



    2



    Upload lab2getnumber.py file



    5








    Upload lab2b.py file



    5








    Implement get_float() and get_int() functions in lab2getnumber module



    10








    Implement calculate_simple_interest() and main() functions in the lab2b.py file



    10








    Upload the test result



    10








    Correct source code



    10







Mar 12, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here