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
Communication of a message between two processes implies which of the following? (A) Synchronization (B) Atomic operation (C) Bl
solong [7]

Answer: Synchronization

Explanation:

In communication of messages between processes we have a mechanism called as the interprocess communication (IPC) using which it is required to achieve synchronization between the process. These synchronization helps to prevent collision of the processes for the shared resources. Examples can be of mechanism of producer consumer problem .

6 0
3 years ago
A line beginning with a # will be transmitted to the programmer’s social media feed.
zhenek [66]

Answer:

True?

Explanation:

4 0
3 years ago
Read 2 more answers
In the context of organizational decisions at the tactical management level, _____ decisions are often used in resolving conflic
natali 33 [55]

Answer:

b. structured

Explanation:

Based on the information being described within the question it can be said that the type of decisions being mentioned are known as structured decisions. These are decisions which have various processes in place in order to handle a certain situation. Usually due to the problem having occurred countless times and are predictable.

4 0
3 years ago
When one citizen has access to digital resources and the other does not, the opportunity gap existing between them is called the
allsm [11]
The digital divide :)
5 0
3 years ago
A company asked you help mitigate the brute force attacks carried out against its users' Windows account passwords. You successf
prohojiy [21]

Answer:

The following options are true.

Explanation:

A corporation has requested the user to support minimize the brute force attacks on credentials of their Microsoft account holder's. They effectively eliminated the malware involved in those assaults and have to protect their credentials allocated towards their user profiles properly without restricting the usefulness of the program.

The following should be included in securing the user accounts are need credentials for the user profile, create logon constraints that failed as well as need powerful credentials.

7 0
3 years ago
Other questions:
  • Melissa and Sue want to show a presentation to twenty employees using a presentation while using a projector. They learn that th
    12·2 answers
  • Binary code what does this mean I was sick so I don't under stand
    7·2 answers
  • It is important that data being imported from a text file into access are separated by a character, such as a comma, which defin
    8·1 answer
  • What weight pencil is recommended for darkening lines and for lettering? *
    7·2 answers
  • After clicking the Start button on your computer screen desktop, what option would you then select to examine system components
    5·1 answer
  • Which is a copyright
    13·2 answers
  • Cognitive psychology is the scientific study of what
    9·1 answer
  • You want the user to enter the length, width, and height from the keyboard. Which cin statement is correctly written?
    10·1 answer
  • In what way , if any, can your social media presence affect your chances of getting a job in social media?
    8·1 answer
  • 2+2? D: I don't knoww​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!