Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

EKYA SCHOOLS / CMR NATIONAL PUBLIC SCHOOL

SUBJECT: COMPUTER SCIENCE


GRADE: VII

Help a Business! Authentic Task Total Marks: 16

Task Details:

This task will use the GRASPS model.


Goal - To design and build a python program that keeps track of items and sales in a business
Role - You are a freelance programmer who has taken on an assignment for ABC company, a small family
owned company. (You can decide what the company sells / rents etc).
Audience - The rest of the class and the teacher will decide on how effective your program is in helping the
business track sales
Situation - As a programmer, you need to ensure that the solution is effective - this means that you choose
the best variable possible, use less lines of code and make sure that the program does not throw an error for
unexpected inputs.
Product - The program solution to track the sales and business
Standards - Added in Schoology

Team Details:

Varun: program
Leelesh: company details
Nishika: company details

Decompose the problem: (Answer the given questions)

1. What are the variables that you would need?


I will need the variables is_finish, price, ac, is_returning, product, amount and amount 2.

2. What would be the data types of these variables?


is_finish, is_returning, product are of data type string and the rest of the variables are of data type
integer.
3. What values should the user input?
The user should input the product, the amount of the product they want to buy and if they want to
buy any more items (yes/no). If not, the program will then ask the user if they want to return any
products, iIf yes he/she should input the product, the amount of the product they want to return and if
they want to return any more items (yes/no).

4. Would you require a loop for this program? Give reasons.


Yes would require a loop for this program as it requires me to keep accepting the products the user
wants to buy or return. This process clearly requires a while loop.

Build the program: (Add the program below)


EKYA SCHOOLS / CMR NATIONAL PUBLIC SCHOOL
SUBJECT: COMPUTER SCIENCE
GRADE: VII

is_finish = 'a'
price = 1
ac = 0
is_returning = 'a'
amount=1
print('Hello welcome to EasyBuy')
print()
print('apple 1kg - ₹40')
print('carrot 1/2kg - ₹16')
print('potato 1kg - ₹50')
print('milk 1l - ₹26')
print('cheese - ₹15')
print('watermellon 3kg- ₹128')
print('oreo - ₹10')
print('dairymilk - ₹25')
print()
while is_finish != 'yes':
product = input('which of these items do you wish to purchase:')
if product not in 'applecarrotpotatomilkcheesewatermellonoreodairymilk':
print('we do not sell this product')
continue
amount = int(input('how much of this product do you wish to buy'))
if product == 'apple':
price = amount * 40
elif product == 'carrot':
price = amount * 16
elif product == 'potato':
price = amount * 50
elif product == 'milk':
price = amount * 26
elif product == 'cheese':
price = amount * 15
elif product == 'watermellon':
price = amount * 128
elif product == 'oreo':
price = amount * 10
elif product == 'dairymilk':
price = amount * 25
is_finish = input('Are these all the items that need to be purchased (yes,no)')
ac = ac + price
print()
print(ac,'is the total price')
print()
is_finish = 'no'
is_returning=input('do you wish to return any items?(yes/no):')
while is_returning != 'yes' and is_returning != 'no':
print('invalid input')
is_returning=input('do you wish to return any items?(yes/no):')
while is_returning == 'yes' and is_finish == 'no':
product = input('which of these items do you wish to return:')
if product not in 'applecarrotpotatomilkcheesewatermellonoreodairymilk':
print('we do not sell this product')
EKYA SCHOOLS / CMR NATIONAL PUBLIC SCHOOL
SUBJECT: COMPUTER SCIENCE
GRADE: VII

continue
amount2 = int(input('how much of this product do you wish to return'))
if amount2 > amount:
print('You have not purchased this quantity of this item and hence cannot return it')
continue
elif product == 'apple':
ac = ac - 40 * amount2
elif product == 'carrot':
ac = ac - 16 * amount2
elif product == 'potato':
ac = ac - 50 * amount2
elif product == 'milk':
ac = ac - 26 * amount2
elif product == 'cheese':
ac = ac - 15 * amount2
elif product == 'watermellon':
ac = ac - 128 * amount2
elif product == 'oreo':
ac = ac - 10 * amount2
elif product == 'dairymilk':
ac = ac - 25 * amount2
is_finish = input('are these all the items you wish to return?(yes/no):')
print()
print(ac, 'is the final price')
print()
print('Thankyou for shoping with us')

Errors and fixes: (Test and refine the program)

1. What are the errors that you encountered and how did you fix these errors?
2. Does the program work for different kinds of input from the user? Mention the inputs that you tested
the program with and sample output that you saw.

Reflect: (To be answered individually)

What was the biggest challenge in completing this task?

Varun: Making the variables was challenging


Leelesh: Thinking of ideas for the company.
Nishika: Thinking of ideas for the company.

What did you like about this task?

Leelesh:He liked to work on company details.


Varun:He liked programming the code.
Nishika:she liked coming up with ideas for the company.

Present the product to the rest of the class

You might also like