COMP 1516—Programming Fundamentals with Python—Assignment #1 Total Marks 30 Due Dates TBD Overview For this assignment, you will generate one of three different reports for one of three different...

The assignment is on Assignment1_comp1516


COMP 1516—Programming Fundamentals with Python—Assignment #1 Total Marks 30 Due Dates TBD Overview For this assignment, you will generate one of three different reports for one of three different inputs. Input Types: · phone data · tablet data · laptop data Report Types: · text · CSV · JSON The input type and report type will be specified as command-line parameters to the Python script (main.py) that you will be creating. You are provided with a Python module (data.py) that has functions that return a list of data for each of the above input types. You will also create a Python module (reports.py) with functions for generating each of the above report types. Your assignment must have no syntax errors and must successfully run (i.e., no runtime errors) for all combinations of the above inputs and outputs. If the script cannot be run, you will receive a mark of zero on this assignment. Full marks will only be given to implementations that are reasonably efficient, i.e., there should NOT be a lot of copy-and-paste code. Requirements The following table identifies the requirements for this assignment. Requirement The command-line parameters are as follows: main.py

Where: · Input type is phone, tablet or laptop. · Report type is text, csv or json. The following errors should be printed to the console for invalid parameters: · Input type must be either phone, table or laptop. · Report type must be either text, csv or json. Make sure you follow best practices for having a main function in this script. Create a module called “reports” in a reports.py file. Create functions for the following three reports in this module: text report, csv report and json report. The output format for the text report should be as follows: Timestamp: Device: Number: Average Price: $ Minimum Price: $ Maximum Price: $ Median RAM: GB Operating Systems: Used formatted strings to generate the csv output. The operating system should be the operating system value AND the version (i.e., Android 5.1.1 Lollipop) The datetime format should be YYYY-MM-DD HH:MM The output format for the csv report should be as follows: ,,,,,,, Use the join function to generate the csv output. The operating system should be the operating system value AND the version (i.e., Android 5.1.1 Lollipop). The format of the list of unique operating systems should look like: Android 5.1.1 Lollipop/Android 7.1 Nougat/Android 9.0 Pie. The datetime format should be YYYY-MM-DD HH:MM. The output format for the json report should be as follows: { “data_time”: “”, “device_type”: “”, “number”: , “average_price”: , “min_price”: , “max_price”: , “median_ram”: , “operating_systems”: [ “”, “”, … ] } Optional: Use the json module to generate the json output. The operating system should be the operating system value AND the version (i.e., Android 5.1.1 Lollipop) The datetime format should be YYYY-MM-DD HH:MM. Correct Output for each input type and report type (see Example Run Configurations to Test below). Full marks will be given for correct output and efficient implementation (limited redundant code). Example Run Configurations to Test There are nine run configurations that must be tested: · main.py phone text · main.py phone csv · main.py phone json · main.py tablet text · main.py tablet csv · main.py tablet json · main.py laptop text · main.py laptop csv · main.py laptop json Sample Output This is the expected output for each of the above run configurations. Your script must produce the same output. \Assinment1 > python main.py phone text Timestamp: 2021-09-28 09:16 Device: Phone Number: 10 Average Price: $419.79 Minimum Price: $249.99 Maximum Price: $599.99 Median RAM: 32.0 GB Operating Systems: Android 6.0 Marshmallow, Android 7.0 Nougat, Android 8.0 Oreo, Android 9.0 Pie, Android 6.0 Marshmallow, Android 5.1.1 Lollipop, Android 7.1 Nougat, Android 7.1 Nougat, Android 5.0.2 Lollipop, Android 5.0.2 Lollipop \Assinment1 > python main.py phone csv 2021-09-28 09:18,Phone,10,419.79,249.99,599.99,32.0,Android 6.0 Marshmallow/Android 7.0 Nougat/Android 8.0 Oreo/Android 9.0 Pie/Android 6.0 Marshmallow/Android 5.1.1 Lollipop/Android 7.1 Nougat/Android 7.1 Nougat/Android 5.0.2 Lollipop/Android 5. 0.2 Lollipop \Assinment1 > python main.py phone json { "date_time": "2021-09-28 09:19", "device_type": "Phone", "number": 10, "average_price": 419.79, "min_price": 249.99, "max_price": 599.99, "median_ram": 32.0, "operating_systems": [ "Android 6.0 Marshmallow", "Android 7.0 Nougat", "Android 8.0 Oreo", "Android 9.0 Pie", "Android 6.0 Marshmallow", "Android 5.1.1 Lollipop", "Android 7.1 Nougat", "Android 7.1 Nougat", "Android 5.0.2 Lollipop", "Android 5.0.2 Lollipop" ] } \Assinment1 > python main.py tablet text Timestamp: 2021-09-28 09:20 Device: Tablet Number: 11 Average Price: $567.95 Minimum Price: $139.99 Maximum Price: $1599.00 Median RAM: 64.0 GB Operating Systems: iOS 12.3, iOS 12.3, iOS 12.3, Android 5.1.1 Lollipop, Android 6.0 Marshmallow, Windows 10 Home, Windows 10 Pro, Windows 10 Pro, Android 7.0 Nougat, Android 7.0 Nougat, Windows 10 Home \Assinment1 > python main.py tablet csv 2021-09-28 09:55,Tablet,11,567.95,139.99,1599.0,64,iOS 12.3/iOS 12.3/iOS 12.3/Android 5.1.1 Lollipop/Android 6.0 Marshmallo w/Windows 10 Home/Windows 10 Pro/Windows 10 Pro/Android 7.0 Nougat/Android 7.0 Nougat/Windows 10 Home \Assinment1 > python main.py tablet json { "date_time": "2021-09-28 09:56", "device_type": "Tablet", "number": 11, "average_price": 567.95, "min_price": 139.99, "max_price": 1599.0, "median_ram": 64, "operating_systems": [ "iOS 12.3", "iOS 12.3", "iOS 12.3", "Android 5.1.1 Lollipop", "Android 6.0 Marshmallow", "Windows 10 Home", "Windows 10 Pro", "Windows 10 Pro", "Android 7.0 Nougat", "Android 7.0 Nougat", "Windows 10 Home" ] } \Assinment1 > python main.py laptop text Timestamp: 2021-09-28 09:57 Device: Laptop Number: 12 Average Price: $1092.98 Minimum Price: $274.99 Maximum Price: $1869.00 Median RAM: 8.0 GB Operating Systems: MacOS 10.13 High Sierra, MacOS 10.13 High Sierra, MacOS 10.13 High Sierra, Windows 10 Home, Windows 10 H ome, Windows 10 Home, Windows 10 Pro, Windows 10 Pro, Windows 10 Home, Chrome OS 74, Windows 10 Home, Chrome OS 74 \Assinment1 > python main.py laptop csv 2021-09-28 09:57,Laptop,12,1092.98,274.99,1869.0,8.0,MacOS 10.13 High Sierra/MacOS 10.13 High Sierra/MacOS 10.13 High Sierr a/Windows 10 Home/Windows 10 Home/Windows 10 Home/Windows 10 Pro/Windows 10 Pro/Windows 10 Home/Chrome OS 74/Windows 10 Hom e/Chrome OS 74 \Assinment1 > python main.py laptop json { "date_time": "2021-09-28 09:58", "device_type": "Laptop", "number": 12, "average_price": 1092.98, "min_price": 274.99, "max_price": 1869.0, "median_ram": 8.0, "operating_systems": [ "MacOS 10.13 High Sierra", "MacOS 10.13 High Sierra", "MacOS 10.13 High Sierra", "Windows 10 Home", "Windows 10 Home", "Windows 10 Home", "Windows 10 Pro", "Windows 10 Pro", "Windows 10 Home", "Chrome OS 74", "Windows 10 Home", "Chrome OS 74" ] } Submission Submit the following Python files in a zip file called assignment1.zip to the Assignment 1 dropbox in D2L: · main.py—your implementation of the main script · reports.py—your implementation of a reports module · data.py—your data provided with the assignment Make sure you followed naming best practices and included docstring in all functions. Grading Summary Implementation As per the requirements described above AND the test_main.py unit test. 30 marks Marks will be subtracted for each violation of naming standards or missing DocString. Total 30 marks Best Practices · Variable names should be lower_snake_case. · Function names should be lower_snake_case. · All functions should include a docstring comment
Nov 10, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here