|Assignment ID Number||AFFGEHU83939HD|
|Type of Document||Essay|
|Number of Pages||10 Pages|
Programming Logic and Design, 6th Edition
Explain why each of the following names does or does not seem like a good variable name to you.
If myAge and yourRate are numeric variables, and departmentName is a string variable, which of the following statements are valid assignments? If a statement is not valid, explain why not.
Assume that cost = 10 and price = 12. What is the value of each of the following expressions?
Draw a typical hierarchy chart for a paycheck-producing program. Try to think of at least 10 separate modules that might be included. For example, one module might calculate an employees dental insurance premium.
5 . Draw the hierarchy chart and then plan the logic for a program for the sales manager of The Couch Potato Furniture Company. The manager needs a program to determine the profit on any item sold. Input includes the wholesale price and retail price for an item. The output is the items profit, which is the retail price minus the wholesale price. Use three modules. The main program declares global variables and calls housekeeping, detail, and end-of-job modules. The housekeeping module prompts for and accepts a wholesale price. The detail module prompts for and accepts the retail price, computes the profit, and displays the result. The end-of-job module displays the message Thanks for using this program.
6. a. Draw the hierarchy chart and then plan the logic for a program that calculates the gown size a student needs for a graduation ceremony. The program uses three modules. The first prompts a user for and accepts the students height in inches. The second module accepts the students weight in pounds and converts the students height to centimeters and weight to grams. Then, it calculates the graduation gown size needed by adding 1/3 of the weight in grams to the value of the height in centimeters. The programs output is the gown size the student should order. There are 2.54 centimeters in an inch and 453.59 grams in a pound. Use named constants wherever you think they are appropriate. The last module displays the message End of job.
b. Revise the size-determining program to execute continuously until the user enters 0 for the height in inches.
7. 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 customers last name. While the user does not enter ZZZZ 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 customers 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.
8. Draw the hierarchy chart and design the logic for a program for the owner of Bits and Pieces Manufacturing Company, who needs to calculate an employees projected salary following a raise. The input is the name of the employee, the employees current weekly salary, and the percentage increase expressed as a decimal (for example, 0.04 for a 4 percent raise). Design the program so that it runs continuously for any number of employees using three modules. The housekeeping module prompts the user for the percent raise that will be applied to every employee, and prompts for the first employees name. The detail loop executes continuously until the user enters XXX for the employees name. The detail loop gets the employees weekly salary, applies the raise, produces the result, and prompts for the next employee 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.
9. Draw the hierarchy chart and design the logic for a program for the manager of the Jeter County softball team, who wants to compute batting averages for his players. A batting average is computed as hits divided by at-bats, and is usually expressed to three decimal positions (for example, .235). Design a program that prompts the user for a player jersey number, the number of hits, and the number of at-bats, and then displays all the data, including the calculated batting average. The program accepts players continuously until 0 is entered for the jersey number. Use appropriate modules, including one that displays End of job after the sentinel is entered for the jersey number.
10. Create a flowchart or pseudocode that shows the logic for a program that generates a random number, then asks the user to think of a number between 1 and 10. Then display the randomly generated number so the user can see whether his or her guess was accurate. (In future chapters you will improve this game so that the user can enter a guess and the program can determine whether the user was correct.)
11. Many programming style guides are published on the Web. These guides suggest good identifiers, explain standard indentation rules, and identify style issues in specific programming languages. Find style guides for at least two languages (for example, C++, Java, Visual Basic, or C#) and list any differences you notice.
12. In this chapter, you learned the term mnemonic, which is a memory device like the sentence Every good boy does fine. Another popular mnemonic is May I have a large container of coffee? What is its meaning? Have you learned other mnemonics as you have studied various subjects? Describe at least five other mnemonics that people use for remembering lists of items.
13. What advantages are there to requiring variables to have a data type?
14. Would you prefer to write a large program by yourself, or work on a team in which each programmer produces one or more modules? Why?
15. Extreme programming is a system for rapidly developing software. One of its tenets is that all production code is written by two programmers sitting at one machine. Is this a good idea? Does working this way as a programmer appeal to you? Why or why not?
|Criteria||0 – 1 Points||2 – 3 Point||4 – 5 Points||Total|
|Professional communication||Unprofessional communication; many errors; no APA||Minor grammar, spelling, and APA errors||Postings are professional and in standard written English with APA|
|Complete addressing of assessment criteria||Criteria not fully addressed||Minimal response to criteria; minor aspects missing||All criteria are fully addressed|
|Evidence of critical thinking or extending information||Critical thinking or extending information not evident||Obvious responses to questions; little thought evident||Posts demonstrate critical thinking with evidence base from research or experience|
|Course connections.||No connections provided||Minimal connections provided to readings/activities||Clear connections to readings/activities|
|Submitted an overview / summary of the case selected for analysis. Also identified those procedural steps to be analyzed.||Did not provide an adequate overview or summary of the selected case or failed to identify those steps to be analyzed.||Provides an adequate overview or summary of the selected case and steps to be analyzed though may not be clear or complete.||Case overview is clearly presented including all appropriate investigative steps to be analyzed.|