1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
S_A_V [24]
3 years ago
14

For this lab you will do 2 things:

Computers and Technology
1 answer:
zepelin [54]3 years ago
4 0

Answer:

Here is the Python program:

COOKIES_PER_BAG = 40 #sets constant value for bag of cookies

SERVINGS_PER_BAG = 10 #sets constant value for serving in bag

CALORIES_PER_SERVING = 300 #sets constant value servings per bag

cookies = int(input("How many cookies did you eat? ")) #prompts user to input how many cookies he or she ate

totalCalories = cookies * (CALORIES_PER_SERVING / (COOKIES_PER_BAG / SERVINGS_PER_BAG)); #computes total calories consumed by user

print("Total calories consumed:",totalCalories) #displays the computed value of totalCalories consumed

Explanation:

The algorithm is:

  • Start
  • Declare constants COOKIES_PER_BAG, SERVINGS_PER_BAG and CALORIES_PER_SERVING
  • Set COOKIES_PER_BAG to 40
  • Set SERVINGS_PER_BAG to 10
  • Set CALORIES_PER_SERVING to 300
  • Input cookies
  • Calculate totalCalories:                                                                                                                       totalCalories ← cookies * (CALORIES_PER_SERVING / (COOKIES_PER_BAG / SERVINGS_PER_BAG))
  • Display totalCalories

I will explain the program with an example:

Lets say user enters 5 as cookies he or she ate so

cookies = 5

Now total calories are computed as:

totalCalories = cookies * (CALORIES_PER_SERVING / (COOKIES_PER_BAG / SERVINGS_PER_BAG));  

This becomes:

totalCalories = 5 * (300/40/10)

totalCalories = 5 * (300/4)

totalCalories = 5 * 75

totalCalories = 375

The screenshot of program along with its output is attached.

You might be interested in
List 7 internal components in a computer system
MrRa [10]
Motherboard
processor
graphic card
memory
storage
power supply
sound card
6 0
3 years ago
Read 2 more answers
What is the cell reference for the cell located in the second column and fifth row of a worksheet?
Lena [83]
Its perhaps B2
HOPE THIS HELPS
8 0
3 years ago
If an M/M/1 queue in a server has task arrivals at a rate of 30 per second and serves at a rate of 50 per second, how many tasks
Scorpion4ik [409]

The answer & explanation for this question is given in the attachment below.

6 0
3 years ago
In theory, a hacker with a small but powerful directional antenna could access a wireless network from more than one mile away.
Svetradugi [14.3K]
100 miles i assume since the avarge antanna cover 5-50 miles
3 0
3 years ago
When using color in a computer - generated presentation aids you should use?
Temka [501]
<span>the answer is: the same background color on all visuals and no more than two colors for words.</span>
6 0
3 years ago
Other questions:
  • This type of technology does not come with a keyboard or mouse for input
    11·2 answers
  • What is a googleplex?
    7·1 answer
  • Working for the Internal Revenue Service is a career in public safety. A. True B. False
    14·1 answer
  • A modern version of the BIOS firmware is called?
    12·1 answer
  • Does anyone have the GCSE 2018 Design Technology J310/01 practice paper?
    15·1 answer
  • The words that follow a code number in the cpt manual are called the
    12·1 answer
  • Write a function called no_you_pick. no_you_pick should have two parameters. The first parameter is a dictionary where the keys
    5·1 answer
  • Difference between a port and a connector
    10·1 answer
  • Several small stores rent space within a larger shopping centre. The owners of the shopping centre have provided a physical netw
    15·1 answer
  • Guidewords for the word “serpent” may be
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!