logo Hurry, Grab up to 30% discount on the entire course
Order Now logo

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Namita JainFinance
(5/5)

886 Answers

Hire Me
expert
Sachin RanaComputer science
(5/5)

799 Answers

Hire Me
expert
StatAnalytica ExpertSocial sciences
(5/5)

922 Answers

Hire Me
expert
Fiona EwingStatistics
(5/5)

995 Answers

Hire Me
Python Programming
(5/5)

Create a script in a main.py that takes in command line arguments.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Overview

For this assignment, you will be generating 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 or provided unit test cannot be run, you will receive a mark of zero on this assignment.

Marks will be based largely on the output from the provided unit test file (test_main.py) when run. 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

Create a script in a main.py that takes in command line arguments.

The command-line arguments are as follows:

main.py <input type> <report type>

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:

• Invalid number of command-line arguments.

• Input type must be either phone, tablet 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.

You may also have other functions in this script that calculate the various statistics for the input data. For example:

def calculate_statistics(input_type):

"Calculates the statistics for the given input type and data "

# Return values such as:

# current_datetime, device_name, num_devices,

# avg_price, min_price, max_price, median_ram, oses

Create a module called reports in a reports.py file. Creates functions for the following three reports in this module: text report, CSV report, and JSON report.

The function signatures should look like this:

def text_report(date, type, num_devices, avg_price,

min_price, max_price, median_ram, oses):

pass

def csv_report(date, type, num_devices, avg_price,

min_price, max_price, median_ram, oses):

pass

def json_report(date, type, num_devices, avg_price,

min_price, max_price, median_ram, oses):

pass

The output format for the text report should be as follows:

Date: <date time or report>

Device: <device type – Mobile Phone, Tablet or Laptop>

(5/5)
Attachments:

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme