Page 1 of 1

Pet Food Purchasing Project in Python (CS 135, Computer Science 1) You are tasked with developing a program for a pet fo

Posted: Sat May 14, 2022 7:07 pm
by answerhappygod
Pet Food Purchasing Project in Python (CS 135, Computer Science
1)
You are tasked with developing a program for a pet food store.
The program keeps track of how many bags of
pet food each customer buys. The store awards a free bag of food to
each customer for every four purchases
(in other words, every fifth bag of food is free). Then the cycle
begins again.
Your program should start by reading the food data file, creating
several objects in a list or other structure. It
should then provide the user with a menu of food items (you should
come up with at least 5 different pet food
choices).
The program should ask if they are a new customer or a previous
customer, and ask them to type in their
name. If it’s a returning customer, the program should go into the
customer file and find how many bags of
food they have previously purchased. The number of bags purchased
should be updated for returning
customers. If it’s a new customer, you’ll be adding a new line to
the customer file with the first purchase.
Your program should be able to list what food is available and
allow the customer to select a food to purchase,
showing a price to the customer, asking for a confirmation, and
then outputting the number of bags of food
they have purchased so far. Every fifth bag of food should be
free.
Once a customer has purchased a bag, then the program should return
to the original state, asking for a new
customer name.
Required data files and formats:
The pet food data file can be created once and will only be read.
You do not need to update this file
programmatically (unless you want to allow the user to add more
products to spice up the program).
• petfood.txt should be composed of several lines that look like
the following: productname,cost
The customer data file will be updated by your program on every
run.
• customer.txt should be composed of several lines that look like
the following:
lastname,firstname,bagcount