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
Mnenie [13.5K]
1 year ago
15

With the cold winter months fast approaching, Lungi wants to improve the overall effectiveness of operations at his NGO. He want

s to keep track of all the blankets he has in stock and be able to determine how many he has left on distribution days. In the past, it has happened that Lungi thought he had blankets to hand out but in fact had none left. Lungi found out that you are an IT student who needs to find a client for their final year IT project. He has volunteered to be your client. Q.1.1 Plan the logic for Lungi’s application using pseudocode. The logic needs to satisfy the following needs:  The application will need to allow Lungi to enter the number of blankets he wishes to distribute on a given day.  The application should keep track of the number of blankets handed out to ensure that Lungi does not hand out more blankets than he has.  The application will need to warn Lungi when he has only one (1) blanket left to hand out.  Once all the blankets have been handed out, the following report should be produced:  The pseudocode should incorporate the use of modules.  The pseudocode should implement the features of good program design.  Use at least one loop structure appropriately.  Use at least one selection structure appropriately.
Computers and Technology
1 answer:
igor_vitrenko [27]1 year ago
5 0
There would not be enough blankets
You might be interested in
Question 1. (50 points) 1.Write a program that computes information related to a sequence of entries regarding age of customers.
schepotkina [342]

Answer:

The solution code is written in Python 3:

  1. count = 0
  2. totalAge = 0
  3. group1_count = 0    #age < 10
  4. group2_count = 0    #age 10 - 20
  5. group3_count = 0    #age 20 - 40
  6. group4_count = 0    #age > 40
  7. group1_total = 0    #subtotal age <= 10
  8. group2_total = 0    #subtotal age 11 - 20  
  9. group3_total = 0    #subtotal age 21 - 40  
  10. group4_total = 0    #subtotal age > 40
  11. age = int(input("Input an age: "))
  12. youngest = age
  13. oldest = age
  14. while(age != -1):
  15.    count += 1
  16.    totalAge += age
  17.    
  18.    if(age <= 10):
  19.        group1_count += 1
  20.        group1_total += age
  21.    elif(age <= 20):
  22.        group2_count += 1
  23.        group2_total += age
  24.    elif(age <= 40):
  25.        group3_count += 1
  26.        group3_total += age
  27.    else:
  28.        group4_count += 1
  29.        group4_total += age
  30.    if(youngest > age):
  31.        youngest = age  
  32.    
  33.    if(oldest < age):
  34.        oldest = age  
  35.    age = int(input("Input an age: "))
  36.    
  37. totalCustomer = count  
  38. avgAge = totalAge / count  
  39. rangeAge = oldest - youngest  
  40. avgAgeGroup1 = group1_total / group1_count  
  41. avgAgeGroup2 = group2_total / group2_count  
  42. avgAgeGroup3 = group3_total / group3_count  
  43. avgAgeGroup4 = group4_total / group4_count  
  44. print("The total number of customers: " + str(totalCustomer))
  45. print("Total number of customer in Group 1 (<=10): " + str(group1_count))
  46. print("Total number of customer in Group 2 (11 - 20): " + str(group2_count))
  47. print("Total number of customer in Group 3 (21 - 40): " + str(group3_count))
  48. print("Total number of customer in Group 4 (> 40): " + str(group4_count))
  49. print("Average age for all customer: " + str(avgAge))
  50. print("Youngest age: " + str(youngest))
  51. print("Oldest age: " + str(oldest))
  52. print("The range of age: " + str(rangeAge))
  53. print("Average age for group 1 (<=10): " + str(avgAgeGroup1))
  54. print("Average age for group 2 (11 - 20): " + str(avgAgeGroup2))
  55. print("Average age for group 3 (21 - 40): " + str(avgAgeGroup3))
  56. print("Average age for group 4 (> 40): " + str(avgAgeGroup4))

Explanation:

Firstly, create the counter variables (e.g. count, group1_count, group2_count etc ) to track the total number of customer and number in each age group. Besides, create variables to hold the value of total of age and sub-total of each age group (Line 1 - 10). We presume there are only four age groups.

Next, prompt user to input the first age (Line 12)

Create variable youngest and oldest to track the lowest and highest age (Line 13 -14). At the moment, set the first input age as value of youngest and oldest.

Create a while loop with sentinel value  -1 (Line 16). Within the loop, track the customer occurrence by incrementing counter variables by one (Line 17, 21, 24, 27 & 30). At the same time, add the current input age to totalAge and to group total (Line 18, 22, 25, 28, & 31).

If the current youngest value is bigger than the current input age, we set the current age to youngest (Line 33- 34).

If the current oldest value is smaller than the current input age, we set the current age to oldest (Line 36- 37).

After terminating the loop with -1, calculate the average age for all customers and for each age group and the range of age (Line 42- 48)  

At last, display all the required calculation results using print function (50 - 62)

7 0
2 years ago
You have used loops for repetitive processes.
zzz [600]

Answer:

for

Explanation:

because:

  • IF = conditional
  • WHILE = conditional
  • DO = isn't a loop function
5 0
3 years ago
How do you take a screen shot on hp pavilion dm3
drek231 [11]
Press and hold down the "Fn" button while pressing the "Home Prt Sc" button above the numeric keypad to capture the entire screen. Make a screenshot of the active window only by holding down the "Fn" and Alt" keys while pressing "Home Prt Sc." 2. Press the "Start" button, and type "Paint" into the search box.
5 0
3 years ago
¿que significa “TTAQMMQMPDATLSPLNDTMGCCLFEQMMPQTEIUMDR” ?
OlgaM077 [116]

Answer: what

Explanation:

5 0
2 years ago
Read 2 more answers
What does the shell of an operating system do
Andre45 [30]

The OS shell allows access to the operating system services

8 0
2 years ago
Other questions:
  • Given the function definition
    12·1 answer
  • Which is an example of a student practicing ethical behavior online??
    7·2 answers
  • 2. Use inheritance to create a hierarchy of Exception classes -- EndOfSentenceException, PunctuationException, and CommaExceptio
    6·1 answer
  • The "fathers of the Internet" are Vinton Cerf and ________. Select one: A. Tim Berners-Lee B. Bill Gates C. Robert Kahn D. Rober
    8·1 answer
  • Write a program to read 10 integers from an input file and output the average, minimum, and maximum of those numbers to an outpu
    14·1 answer
  • In what way, if any, has community building changed in the age of digital media? People’s community building has not changed in
    13·1 answer
  • Write a program code which asks for 80 numbers between 100 and 1000 to be entered.
    7·1 answer
  • Ten ways ict has helped in social development
    7·1 answer
  • An operating system with _____ capabilities allows a user to run more than one program concurrently.
    6·1 answer
  • ANSWER QUICKLY!!! <br><br> Which aspect of planning is a preventive action?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!