Question

Hello. I need some assistance in solving this problem for my computer programming class. The program...

Hello. I need some assistance in solving this problem for my computer programming class. The program I use is Python 3.7, and I also want a pseudocode for this program as well.

Thanks.

Problem: A bag of cookies holds 40 cookies. The calorie information on the bag claims that there are 10 “servings” in the bag and that a serving equals 300 calories. Write pseudocode to solve this problem and then write a Python program that asks the user to input how many cookies he or she ate and then reports how many total calories were consumed.

*You MUST USE constants to represent the number of cookies in the bag, number of servings, and number of calories per serving. Remember to put constants in all caps!

Make sure to declare and initialize all variables before using them! Then you can do the math using those constants to find the number of calories in each cookie.

Make this program your own by personalizing the introduction and output.

Sample Output:

WELCOME TO THE CALORIE COUNTER!!

Please enter the number of cookies consumed: 5

You consumed 375 calories.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

`Hey,

Note: Brother in case of any queries, just comment in box I would be very happy to assist all your queries

TOTALCOOKIES=40.0
SERVINGS=10.0
CALORIES=300.0
perCalorie=CALORIES/(TOTALCOOKIES/SERVINGS);
num=int(input("Enter number of cookies she ate: "));
print("Calories consumed is",(num*perCalorie),"calories");

PSEUDOCODE

Total cookies=40

servings=10

each serving has calories=300

4 cookies has calories=300

1 cookie has calories=300/4=75calories

enter the number of cookies he she ate =X;

calories consumed=75*X calories;

Kindly revert for any queries

Thanks.

Add a comment
Know the answer?
Add Answer to:
Hello. I need some assistance in solving this problem for my computer programming class. The program...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT