×
Samples Blogs Make Payment About Us Reviews 4.9/5 Order Now

Python Assignment Solution: Building a Vinyl Record Management System

July 15, 2024
Prof. James Harper
Prof. James
🇦🇪 United Arab Emirates
Python
Prof. James Harper is an experienced software developer and educator with a Master's degree in Computer Science from the University of Melbourne. With over 900 completed assignments, he specializes in Python programming and application development. Prof. Harper's passion for teaching and extensive industry experience ensure that his solutions are not only functional but also well-documented and easy to understand.
Key Topics
  • Instructions
  • Requirements and Specifications
Tip of the day
Start with basic image processing concepts like color spaces and transformations. Practice simple OpenCV examples to build confidence before tackling complex tasks.
News
In 2024, the release of the 'AsyncIO Toolkit' has made asynchronous programming in Python more efficient. Similarly, 'React Quantum' introduces quantum computing concepts to JavaScript, expanding learning opportunities for students.

Instructions

Objective

Write a program to implement vinyl-record-system in python language.

Requirements and Specifications

To complete python assignment, my class is using an excel file with a list of the inventory of music media, band names, songs,release dates, and conditions that they are in.

Source Code

""" Chapter 12: working with files Name: Maxwell Sabel File: ch12_vinyl_record_v5.py Course: CIS 156, CGCC """ import datetime # this module helps us get the current year import csv # here we are bringing in a library that helps read files YEAR_OF_FIRST_VINYL_LP = 1948 # Part 1: as in previous weeks, you'll need to edit these next lines to find and place your files # Use a file manager to see the full path of this file, then edit the text string inside the # single quotes to match your system. # Leave the leading lowercase r in place (this tells Python not to react to the symbols in the text) # # I happen to be using a directory called CIS156 under Documents. # What you see below is on a Windows system... on a Mac this might look like # r'/Users/david/Documents/CIS156/ch12_spring_2021_input_inventory.csv' # Please keep the actual filenames (ch12_spring_2021_input_inventory.csv and ch12_report.txt) unchanged. INPUT_FILE = r'C:\Users\sabel\OneDrive\Desktop\ch12_spring_2021_input_inventory.csv' OUTPUT_FILE =r'C:\Users\sabel\OneDrive\Desktop\ch12_report.txt' # BONUS 5 POINTS # Modify above... incorporate os module as described in this week's chapter and make these file names a bit easier # to find no matter what operating system you're on. # Note: don't get hung up here... get all the other Parts working, then come back if you have time and interest # in adding the os module. # Part 2 - complete the following function def read_inventory_from_a_file(in_filename): """Gets our inventory, returns a list of (you decide) Parameters: arg1 in_filename (string): a valid filename returns: a list (You decide what the list is... could be a list of Vinyl_Record objects(Ch9), could be a list of lists (Ch8) - your choice csv File format: text only .csv file with the following format: Title,Artist,Year Released,Condition (no spaces between). The first row is a header. Title and Artist are plain text Year released is plain text Condition is a few word description in plain text. Examples: scratched, near-perfect, warped Return: a list of (you decide) """ ### your code goes next ### ### end of your code ### #### end of load_inventory_from_a_file #### def today_timestamp(): """Get today's date and time, return as a string""" currentDT = datetime.datetime.now() return currentDT.strftime("%a, %b %d, %Y, %I:%M:%S %p") def splashscreen(): print("Chapter 12 - working with files, v5.") # print("Now we add exception handling and error bounds on the year of album release") print() def goodby(): print('\n*** End of Ch12 working with files ***') def main(): splashscreen() # Ok, let's load in our inventory from the file print("Reading in our inventory") our_inventory = read_inventory_from_a_file(INPUT_FILE) # print_an_inventory(our_inventory) print("Writing our report to disk") # Part 3 - Insert code to open the output file # We'd like a text file written to disk that tells us some useful "at a glance" information about our inventory, # like obvious mistakes in our data, the number of albums we have in various decades, and the total size of our inventory. # Add code below to open the OUTPUT_FILE (specified at the top of this file) for writing. # Put some title at the top of your report describing what the report, the current date, and include your name. # If you want a starting spot, something like x.write("*** Vintage Vinyl on Wheels ***\n"), # followed by x.write(today_timestamp() + "\n") is a beginning, where "x" is the output file handle you've used. # See the example ch12_report.txt supplied in the homework. You must contain all the information shown, # but you do not have to follow the precise formatting. In other words, include the requested information, # but make this look the way you think is pleasing and easy to read. # Hint: you will find that a lot of "\n" newlines are needed... the .write() method does not automatically append a # newline like print() does, so you have to supply those yourself. # your code goes next # end of your code # Part 4 - Continue to write more information into the report file. For Part 4, report on any # incorrect values in our inventory, focused on invalid values for year_released. # For the purposes of this week's homework, let's assume that year_released is # actually correctly stored as an integer, and if the value is 0, then clearly we have a mistake, # so, for each album in your inventory that has a year_released of 0, put out a line in your output file and # put their title, artist, and year_released along with a few words to show it needs to be fixed. # your code goes next # end of your code # Part 5 - Now we need some stats... # As our last part, write some information into your file that tells us about our inventory. # The information needed: # Golden Oldies: any album released between 1948 to 1959, inclusive. I only want to know the quantity. # The Rock Era: any album released between 1960 to 1999, inclusive. I only want to know the quantity. # The 2000s: any album released from 2000 onward, inclusive. I only want to know the quantity. # # Finally, we'd like to know the total number of albums in our current inventory # your code goes next # end of your code print("Closing the report file") out_file.close() # close the file. Modify this line to match your file handle... I happened to use "out_file" goodby() # end of main # call main if __name__ == '__main__': main() # Copyright 2021 David Baker

Related Samples

Explore our Python samples to understand our expertise in delivering top-notch solutions. Our curated examples showcase Python projects ranging from basic assignments to complex algorithms, highlighting our commitment to quality and precision. Trust us for comprehensive Python programming help tailored to meet your academic needs.