A programmer's wife tells him, While you're at the grocery store, buy some eggs. He never...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
A programmer's wife tells him, "While you're at the grocery store, buy some eggs." He never comes back. Now, imagine a situation in which such a programmer does shopping in a grocery owned by a nerdy! Things can even get more complicated, right? Joking aside, in this part of the assignment, you as a programmer are supposed to help a nerdy owner of a grocery by writing a program called Nerdy Grocery as follows. The grocery store owner designed a very strange pricing regulation for their products, in which the price of a product only depends on its weight. If the weight of a product is a prime number, the price of the product is equal to the number of prime numbers less than the weight of the product. For example, if the weight of a product is 7, the price would be $3, because there are three prime numbers less than 7, which are 2, 3, 5. If the weight of a product is not a prime number, the price is equal to the number of prime divisors of the weight. For example, if the weight of a product is 6, the price would be $2, because 6 has two prime divisors, which are 2 and 3. Moreover, the grocery offers a discount based on the total price of a customer's shopping: If the total price of shopping is a prime number, the grocery offers a discount equal to the number of prime numbers less than the total price. If the total price of shopping is not a prime number, the grocery offers a discount equal to the number of prime divisors of the total price. Nerdy Grocery helps the grocery and its customers to facilitate the payment process as follows: NerdyGrocery first, receives the number of products in the customer's shopping basket. Let's call this number n. Nerdy Grocery assumes the user only enters positive integers (greater than 0). Subsequently, Nerdy Grocery receives the weight of each product in n separate lines. NerdyGrocery assumes the user only enters positive integers (greater than 0). Nerdy Grocery calculates the total price of the customer's shopping considering the above-mentioned regulation and after applying the corresponding discount. A programmer's wife tells him, "While you're at the grocery store, buy some eggs." He never comes back. Now, imagine a situation in which such a programmer does shopping in a grocery owned by a nerdy! Things can even get more complicated, right? Joking aside, in this part of the assignment, you as a programmer are supposed to help a nerdy owner of a grocery by writing a program called Nerdy Grocery as follows. The grocery store owner designed a very strange pricing regulation for their products, in which the price of a product only depends on its weight. If the weight of a product is a prime number, the price of the product is equal to the number of prime numbers less than the weight of the product. For example, if the weight of a product is 7, the price would be $3, because there are three prime numbers less than 7, which are 2, 3, 5. If the weight of a product is not a prime number, the price is equal to the number of prime divisors of the weight. For example, if the weight of a product is 6, the price would be $2, because 6 has two prime divisors, which are 2 and 3. Moreover, the grocery offers a discount based on the total price of a customer's shopping: If the total price of shopping is a prime number, the grocery offers a discount equal to the number of prime numbers less than the total price. If the total price of shopping is not a prime number, the grocery offers a discount equal to the number of prime divisors of the total price. Nerdy Grocery helps the grocery and its customers to facilitate the payment process as follows: NerdyGrocery first, receives the number of products in the customer's shopping basket. Let's call this number n. Nerdy Grocery assumes the user only enters positive integers (greater than 0). Subsequently, Nerdy Grocery receives the weight of each product in n separate lines. NerdyGrocery assumes the user only enters positive integers (greater than 0). Nerdy Grocery calculates the total price of the customer's shopping considering the above-mentioned regulation and after applying the corresponding discount.
Expert Answer:
Answer rating: 100% (QA)
def isprime num if num 1 if if num divisor 0 divisor 1 count 1 while num divisor num ... View the full answer
Related Book For
Fundamentals of Case Management Practice Skills for the Human Services
ISBN: 978-1305094765
5th edition
Authors: Nancy Summers
Posted Date:
Students also viewed these programming questions
-
Negotiations take place in many different global contexts. They may be in person, by telephone, or online. What are some of the communication challenges faced in cross-cultural negotiations? ways...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
The Crazy Eddie fraud may appear smaller and gentler than the massive billion-dollar frauds exposed in recent times, such as Bernie Madoffs Ponzi scheme, frauds in the subprime mortgage market, the...
-
Two long wires are placed in the x-y plane, as shown in the figure. Each wire carries a current of 1.5 A, directed out of the page. If the distance d = 3.0 m, what is the net magnetic field due to...
-
Knowing that the coefficients of friction between the component I and member BC of the mechanism of Prob. 12.62 are 0.35 s = and 0.25, k = determine (a) The maximum allowable speed vB if the...
-
Write a program that uses a bag of strings to keep track of a list of chores you have to accomplish today. The user of the program can request several services: (1) Add an item to the list of chores;...
-
XYZ University is a medium-sized tertiary education provider in the state of Queensland, Australia. In undertaking its normal business of teaching, learning, and research, the university collects,...
-
Holmes Company reported the following balance sheets at December 31, 2017 and 2018: Its income statement for 2018 was as follows: ($ in millions)...
-
Mirada Company manufactures handheld calculators and has the following information available for the month of July: Work in process, July 1 ( 1 0 0 % complete for materials, 2 5 % for conversion ) 1...
-
Garvey Company sells machine parts to industrial equipment manufacturers for an average price of $0.75 per part. There are two types of customers: those who place small, frequent orders and those who...
-
Return logistics is sometimes referred to as end-sales support and includes what activity? Inventory control Production control Warranty returns Production
-
As your materials indicate, health care professionals sometimes fail to report child abuse in cases where they believe the child's injury may be abuse-related. However, as discussed in this article,...
-
Some hospitals test new and expecting mothers for drug use, a practice that has been the subject of significant controversy, as discussed in this article. Some hospitals test all women, while others...
-
Max visited a popular venue in town serving beers and delicious pizza with extensive outdoor areas that included a wooden patio and a vast lawn. The venue was crowded, and there were many people...
-
Shuri, a 35-year-old graphic designer, had been working for a small design agency for six years when she was let go without a reason. Her salary was in line with the industry standards, and the...
-
Rodney Smith, an 18-year old Camosun student who took Business Law course, went to Mona Turner his elderly neighbour who was raking leaves. Rodney offered to clean the gutters for $150.00. Mona...
-
43) At 1280 C the equilibrium constant (Kc) for the reaction Br2 (g) 2 Br (g) is 1.1 x 10. If the initial concentrations are [Br] = 0.2 M and [Br] = OM, calculate the concentrations of these species...
-
Economic feasibility is an important guideline in designing cost accounting systems. Do you agree? Explain.
-
Kelly requests a copy of his current treatment plan. You should: a. Have Kelly put the request in writing and discuss the issue with the treatment team. b. Make a copy of the current treatment plan...
-
A woman and her two children are waiting to receive their welfare check. They came to your state from another to escape an abusive husband and father. The woman is frail and appears sick. They have...
-
A woman you have been working with tells you her husband is really a dear. He has done many wonderful things for her, and she is feeling guilty about calling you, but he does keep her confined to the...
-
Approximately 50,000 new titles, including new editions, are published each year in the United States, giving rise to a $25 billion industry in 2001. In terms of percentage of sales, this industry...
-
When you think of political persuasion, you may think of the effortsthat political campaigns undertake to persuade you that their candidate is betterthan the other candidate. In truth, campaigns are...
-
In late 2013, the taxi company Yourcabs.com in Bangalore, India, was facing a problem with the drivers using their platformnot all drivers were showing up for their scheduled calls. Drivers would...
Study smarter with the SolutionInn App