You will design a program that manages the inventory of an electronics store. You will need to use a number of concepts that you learned in class including: use of classes, use of dictionaries and input and output of comma delimeted csv files. Input: a) ManufacturerList.csv -- contains items listed by row. Each row contains item ID, manufacturer name, item type, and optionally a damaged indicator b) PriceList.csv -- contains items listed by row. Each row contains item ID and the item price. c) ServiceDatesList.csv – contains items listed by row. Each row contains item ID and service date. Required Output: 1) Interactive Inventory Query Capability a. Query the user of an item by asking for manufacturer and item type with a single query. i. Print a message(“No such item in inventory”) if either the manufacturer or the item type are not in the inventory, more that one of either type is submitted or the combination is not in the inventory. Ignore any other words, so “nice Apple computer” is treated the same as “Apple computer”. ii. Print “Your item is:” with the item ID, manufacturer name, item type and price on one line. Do not provide items that are past their service date or damaged. If there is more than one item, provide the most expensive item. iii. Also print “You may, also, consider:” and print information about the same item type from another manufacturer that closes in price to the output item. Only print this if the same item from another manufacturer is in the inventory and is not damaged nor past its service date. iv. After output for one query, query the user again. Allow ‘q’ to quit. Need an example code without the use of PANDAS, LAMBDA, ITEMGETTER or DATABASES I have corrected my code but it still does not create an output and I could use some help setting up the "INVENTORY QUERY" Here is my code: import csv field_names = ['item_id', 'item_name', 'item_price', 'item_status', 'item_date'] class Inventory: def __init__(self, item_id, item_name, item_type, item_price, item_status, item_date): self.id = item_id self.name = item_name self.type = item_type self.price = item_price self.status = item_status self.date = item_date self.serviced = None def main(): inventory_list = [] with open('ManufacturerList.csv', 'r') as manufacturer: m_list = csv.reader(manufacturer) for each in m_list: item_id = each[0] item_name = each[1] item_type = each[2] item_status = each[3] inv_list = Inventory(item_id=item_id, item_name=item_name, item_type=item_type, item_status=item_status) inventory_list.append(inv_list) with open('PriceList.csv', 'r') as price: p_list = csv.reader(price) for row in p_list: identifier = row[0] cost = row[1] for item1 in inventory_list: if item1.id == identifier: item1.price = cost with open('ServiceDateList.csv', 'r') as service_date: s_list = csv.reader(service_date) for row in s_list: obj = row[0] serviced = row[1] for item2 in inventory_list: if item2.id == obj: item2.serviced = serviced def sort1(x): return x.name inventory_list.sort(key=sort1) with open('FullInventory.csv', 'w')as file: writer = csv.writer(file) for each in inventory_list: row = [each.id, each.name, each.type, each.price, each.date, each.status] writer.writerow(row) def sort2(x): return x.id inventory_list.sort(reverse=True, key=sort2) with open('LaptopInventory.csv', 'w')as file: writer = csv.writer(file) for each in inventory_list: row = [each.id, each.name, each.type, each.price, each.date, each.status] writer.writerow(row) def sort3(x): return x.date inventory_list.sort(key=sort3) with open('PastServiceDateInventory.csv', 'w')as file: writer = csv.writer(file) for each in inventory_list: if each.date != '#####': row = [each.id, each.name, each.type, each.price, each.date, each.status] writer.writerow(row) def sort4(x): return x.status inventory_list.sort(key=sort4) with open('DamagedInventory.csv', 'w')as file: writer = csv.writer(file) for each in inventory_list: if each.status == 'damaged': row = [each.id, each.name, each.type, each.price, each.date, each.status] writer.writerow(row) if __name__ == '__main__': main()

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter9: Using Classes And Objects
Section: Chapter Questions
Problem 1CP: In previous chapters, you have created programs for the Greenville Idol competition. Now create a...
icon
Related questions
Question

You will design a program that manages the inventory of an electronics store. You will need to use a number of concepts that you learned in class including: use of classes, use of dictionaries and input and output of comma delimeted csv files.


Input:
a) ManufacturerList.csv -- contains items listed by row. Each row contains item ID,
manufacturer name, item type, and optionally a damaged indicator
b) PriceList.csv -- contains items listed by row. Each row contains item ID and the item price.
c) ServiceDatesList.csv – contains items listed by row. Each row contains item ID and service
date.


Required Output:
1) Interactive Inventory Query Capability
a. Query the user of an item by asking for manufacturer and item type with a single query.

i. Print a message(“No such item in inventory”) if either the manufacturer or the
item type are not in the inventory, more that one of either type is submitted or
the combination is not in the inventory. Ignore any other words, so “nice Apple
computer” is treated the same as “Apple computer”.

ii. Print “Your item is:” with the item ID, manufacturer name, item type and price
on one line. Do not provide items that are past their service date or damaged. If
there is more than one item, provide the most expensive item.

iii. Also print “You may, also, consider:” and print information about the same item
type from another manufacturer that closes in price to the output item. Only
print this if the same item from another manufacturer is in the inventory and is
not damaged nor past its service date.

iv. After output for one query, query the user again. Allow ‘q’ to quit.

Need an example code without the use of PANDAS, LAMBDA, ITEMGETTER or DATABASES

I have corrected my code but it still does not create an output and I could use some help setting up the "INVENTORY QUERY"

Here is my code:

import csv

field_names = ['item_id', 'item_name', 'item_price', 'item_status', 'item_date']


class Inventory:
def __init__(self, item_id, item_name, item_type, item_price, item_status, item_date):
self.id = item_id
self.name = item_name
self.type = item_type
self.price = item_price
self.status = item_status
self.date = item_date
self.serviced = None


def main():
inventory_list = []

with open('ManufacturerList.csv', 'r') as manufacturer:
m_list = csv.reader(manufacturer)
for each in m_list:
item_id = each[0]
item_name = each[1]
item_type = each[2]
item_status = each[3]
inv_list = Inventory(item_id=item_id, item_name=item_name, item_type=item_type, item_status=item_status)
inventory_list.append(inv_list)

with open('PriceList.csv', 'r') as price:
p_list = csv.reader(price)
for row in p_list:
identifier = row[0]
cost = row[1]
for item1 in inventory_list:
if item1.id == identifier:
item1.price = cost

with open('ServiceDateList.csv', 'r') as service_date:
s_list = csv.reader(service_date)
for row in s_list:
obj = row[0]
serviced = row[1]
for item2 in inventory_list:
if item2.id == obj:
item2.serviced = serviced

def sort1(x):
return x.name

inventory_list.sort(key=sort1)
with open('FullInventory.csv', 'w')as file:
writer = csv.writer(file)
for each in inventory_list:
row = [each.id, each.name, each.type, each.price, each.date, each.status]
writer.writerow(row)

def sort2(x):
return x.id

inventory_list.sort(reverse=True, key=sort2)
with open('LaptopInventory.csv', 'w')as file:
writer = csv.writer(file)
for each in inventory_list:
row = [each.id, each.name, each.type, each.price, each.date, each.status]
writer.writerow(row)

def sort3(x):
return x.date

inventory_list.sort(key=sort3)
with open('PastServiceDateInventory.csv', 'w')as file:
writer = csv.writer(file)
for each in inventory_list:
if each.date != '#####':
row = [each.id, each.name, each.type, each.price, each.date, each.status]
writer.writerow(row)

def sort4(x):
return x.status

inventory_list.sort(key=sort4)
with open('DamagedInventory.csv', 'w')as file:
writer = csv.writer(file)
for each in inventory_list:
if each.status == 'damaged':
row = [each.id, each.name, each.type, each.price, each.date, each.status]
writer.writerow(row)

if __name__ == '__main__':
main()

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 4 images

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

How is this done without the use of itemgetter?

Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
Unreferenced Objects
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT