Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help with Python 3: 1. A GirlScout constructor takes two arguments, name and num_cookies_sold . The default value of num_cookies_sold is 0. It has

Please help with Python 3:

1. A GirlScout constructor takes two arguments, name and num_cookies_sold. The default value of num_cookies_sold is 0. It has two additional methods.

a) badge_earned() that returns True if the Girl Scout has sold 100 or more cookies and False otherwise.

b) cookies_sold() returns a string of the form "{Scout's name} has sold {number} cookies"

2. Cookies is a class that keeps track of how many of each kind of cookie has been sold. Its constructor takes no arguments.

a) add_type(cookie_name) instructs the object to begin tracking sales of cookie_name cookies. When a new cookie is tracked, its sales are initialized to 0

b) update_sales(cookie_name, num_sold) adds num_sold to cookie_name's sales

c) print_sales() prints a report of sales for each cookie, one cookie per line. Each cookie's report is of the form "{cookie's name}: {number sold}"

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional SQL Server 2012 Internals And Troubleshooting

Authors: Christian Bolton, Justin Langford

1st Edition

1118177657, 9781118177655

More Books

Students also viewed these Databases questions

Question

A phone call to a supplier to check on an overdue parts shipment

Answered: 1 week ago