{"id":218066,"date":"2025-05-23T07:15:31","date_gmt":"2025-05-23T07:15:31","guid":{"rendered":"https:\/\/learnexams.com\/blog\/?p=218066"},"modified":"2025-05-23T07:15:34","modified_gmt":"2025-05-23T07:15:34","slug":"draw-the-hierarchy-chart-and-design-the-logic-for-a-program-that-contains-housekeeping","status":"publish","type":"post","link":"https:\/\/www.learnexams.com\/blog\/2025\/05\/23\/draw-the-hierarchy-chart-and-design-the-logic-for-a-program-that-contains-housekeeping\/","title":{"rendered":"Draw the hierarchy chart and design the logic for a program that contains housekeeping"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Draw the hierarchy chart and design the logic for a program that contains housekeeping, detail loop, and end-of-job modules, and that calculates the service charge customers owe for writing a bad check. The main program declares any needed global variables and constants and calls the other modules. The housekeeping module displays a prompt for and accepts a customer\u2019s last name. While the user does not enter \u201cZZZZ\u201d for the name, the detail loop accepts the amount of the check in dollars and cents. The service charge is computed as $20 plus 2 percent of the check amount. The detail loop also displays the service charge and then prompts the user for the next customer\u2019s name. The end-of-job module, which executes after the user enters the sentinel value for the name, displays a message that indicates the program is complete.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-ast-global-color-1-color\">The Correct Answer and Explanation is:<\/mark><\/strong>.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Problem Summary:<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The program calculates service charges for customers who write bad checks.<\/li>\n\n\n\n<li>Main program declares global variables\/constants and calls three modules: Housekeeping, Detail Loop, and End-of-Job.<\/li>\n\n\n\n<li><strong>Housekeeping Module:<\/strong> Displays prompt and accepts customer&#8217;s last name.<\/li>\n\n\n\n<li><strong>Detail Loop Module:<\/strong> While name \u2260 &#8220;ZZZZ&#8221;, accepts check amount, computes service charge = \\$20 + 2% of check amount, displays service charge, then prompts for next customer name.<\/li>\n\n\n\n<li><strong>End-of-Job Module:<\/strong> After sentinel &#8220;ZZZZ&#8221; is entered, displays completion message.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Hierarchy Chart<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>Main Program\n\u251c\u2500\u2500 Housekeeping Module\n\u251c\u2500\u2500 Detail Loop Module\n\u2514\u2500\u2500 End-of-Job Module<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Main Program<\/strong> controls overall flow.<\/li>\n\n\n\n<li><strong>Housekeeping<\/strong> gets the initial customer name.<\/li>\n\n\n\n<li><strong>Detail Loop<\/strong> processes customers repeatedly until sentinel.<\/li>\n\n\n\n<li><strong>End-of-Job<\/strong> finishes the program.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Logic Design (Pseudocode)<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>Main Program\n    Declare customerName as String\n    Declare checkAmount as Float\n    Declare serviceCharge as Float\n    Declare constant BASE_CHARGE = 20.00\n    Declare constant PERCENT_CHARGE = 0.02\n\n    Call Housekeeping Module (to get first customerName)\n\n    While customerName != \"ZZZZ\"\n        Call Detail Loop Module (pass customerName, get checkAmount)\n        Calculate serviceCharge = BASE_CHARGE + (PERCENT_CHARGE * checkAmount)\n        Display serviceCharge\n        Call Housekeeping Module (get next customerName)\n    End While\n\n    Call End-of-Job Module\nEnd Main Program\n\n\nHousekeeping Module\n    Prompt \"Enter customer's last name (enter ZZZZ to quit): \"\n    Input customerName\n    Return customerName\nEnd Housekeeping Module\n\n\nDetail Loop Module (customerName)\n    Prompt \"Enter amount of bad check for \" + customerName + \": $\"\n    Input checkAmount\n    Return checkAmount\nEnd Detail Loop Module\n\n\nEnd-of-Job Module\n    Display \"Program complete. Thank you.\"\nEnd End-of-Job Module<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">This program is structured into three main modules under the control of a main program, enabling clear separation of concerns and modular programming principles.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>1. Main Program:<\/strong><br>The main program declares the global variables and constants needed throughout the program, including <code>customerName<\/code>, <code>checkAmount<\/code>, and <code>serviceCharge<\/code>, as well as constants for the base service charge and percentage charge. It initiates the process by calling the housekeeping module to receive the first customer\u2019s last name.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>2. Housekeeping Module:<\/strong><br>This module is responsible for input handling of the customer\u2019s last name. It displays a prompt asking the user to enter the last name or &#8220;ZZZZ&#8221; to indicate no more customers. This input controls whether the program will proceed with calculations or terminate. Returning the customer name to the main program keeps input encapsulated and easily maintainable.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>3. Detail Loop Module:<\/strong><br>The detail loop is the core processing unit. For each customer, it requests the amount of the bad check. Then, the program calculates the service charge based on the formula: a flat \\$20 fee plus 2% of the check amount. This fee calculation ensures customers are charged fairly based on the check amount but with a minimum service fee. The service charge is displayed immediately after calculation. Once this is done, the program again calls the housekeeping module to accept the next customer name, thereby forming a loop that continues until the sentinel value &#8220;ZZZZ&#8221; is entered.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>4. End-of-Job Module:<\/strong><br>After exiting the loop (when &#8220;ZZZZ&#8221; is input), the end-of-job module provides a clean ending to the program by displaying a message indicating that processing is complete. This finalizes user interaction and improves program usability.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Modularization<\/strong> allows each part of the program to be developed, tested, and maintained independently. The hierarchy chart clearly illustrates the control flow, with the main program calling each module in sequence and looping through the detail loop as long as necessary. This approach improves clarity, reduces redundancy, and aligns with best practices in software design.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/learnexams.com\/blog\/wp-content\/uploads\/2025\/05\/image-133.png\" alt=\"\" class=\"wp-image-218067\"\/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Draw the hierarchy chart and design the logic for a program that contains housekeeping, detail loop, and end-of-job modules, and that calculates the service charge customers owe for writing a bad check. The main program declares any needed global variables and constants and calls the other modules. The housekeeping module displays a prompt for and [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[25],"tags":[],"class_list":["post-218066","post","type-post","status-publish","format-standard","hentry","category-exams-certification"],"_links":{"self":[{"href":"https:\/\/www.learnexams.com\/blog\/wp-json\/wp\/v2\/posts\/218066","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.learnexams.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.learnexams.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.learnexams.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.learnexams.com\/blog\/wp-json\/wp\/v2\/comments?post=218066"}],"version-history":[{"count":0,"href":"https:\/\/www.learnexams.com\/blog\/wp-json\/wp\/v2\/posts\/218066\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.learnexams.com\/blog\/wp-json\/wp\/v2\/media?parent=218066"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.learnexams.com\/blog\/wp-json\/wp\/v2\/categories?post=218066"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.learnexams.com\/blog\/wp-json\/wp\/v2\/tags?post=218066"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}