Only 20 percent of the nursery stock does well in shade and 50 percent does

Only 20 percent of the nursery stock does well in

This preview shows page 15 - 22 out of 58 pages.

either “clay” or “sandy”. Only 20 percent of the nursery stock does well in shade, and 50 percent does well in sandy soil. Customers have requested a report that lists the name and price of each plant that would be appropriate in a shady, sandy yard. a. Design the print chart for this program. b. Draw the hierarchy chart for this program. c. Create a decision table to use while planning the logic for this program. d. Draw the flowchart for this program. e. Write the pseudocode for this program. a. Print chart: 1 2 3 4 5 6 7 8 9 1 0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 2 0 2 1 2 2 2 3 2 4 2 5 2 6 2 7 2 8 2 9 3 0 3 1 3 2 3 3 3 4 3 5 3 6 3 7 3 8 3 9 4 0 1 P l a n t s f o r S h a d y , S a n d y Y a r d s 2 3 P l a n t N a me P l a n t P r i c e 4 5 X X X X X X X X X X X X X X X X X 9 9 9 9 . 9 9 6 X X X X X X X X X X X X X X X X X 9 9 9 9 . 9 9 7 X X X X X X X X X X X X X X X X X 9 9 9 9 . 9 9 8 9 10 11 b. Hierarchy chart: main( ) headings( ) housekeeping( ) mainLoop( ) finishUp( )
Image of page 15
c. Decision table: Condition Outcome plantLight = "shady" T T F F plantSandy = "sandy" T F T F print plantName X don't print X X X
Image of page 16
d. Flowchart: start housekeeping() eof? finishUp() stop mainLoop() finishUp() close files return headings() print heading1 print heading2 return housekeeping() declare variables open files headings() read plantRec return plantRec char plantName num plantPrice char plantLight char plantSoil char heading1 = “Plants for Shady, Sandy Yards char heading2 = “Plant Price” mainLoop() plantLight = “shady”? plantSoil = “sandy” ? print plantName, plantPrice read plantRec return No Yes Yes No Yes No
Image of page 17
e. Pseudocode: start perform housekeeping( ) while not eof perform mainLoop( ) endwhile perform finishUp( ) stop housekeeping( ) define variables open files perform headings( ) read plantRec return headings( ) print heading1 print heading2 return mainLoop( ) if plantLight = "shady" then if plantSoil = "sandy" then print plantName endif endif read plantRec return finishUp( ) close files return
Image of page 18
7. You have declared variables for an insurance company program as follows: FIELD POSITIONS EXAMPLE num custPolicyNumber 1–6 223356 char custLastName 7–20 Falkenburg num custAge 21–23 25 num custDueMonth 24–25 06 num custDueDay 26–27 24 num custDueYear 28–31 2005 num custAccidents 32–34 2 Draw the flowchart or write the pseudocode for the selection structures that print the custPolicyNumber and custLastName for customers whose data satisfy the following requests for lists of policyholders: a. over 35 years old b. at least 21 years old c. no more than 30 years old d. due no later than March 15 any year e. due up to and including January 1, 2005 f. due by April 27, 2008 g. due as early as December 1, 2004 h. fewer than 11 accidents i. no more than 5 accidents j. no accidents a. if custAge > 35 then print custPolicyNumber, custLastName endif
Image of page 19
b. if custAge >=21 then print custPolicyNumber, custLastName endif c. if custAge <= 30 then print custPolicyNumber, custLastName endif
Image of page 20
d.
Image of page 21
Image of page 22

You've reached the end of your free preview.

Want to read all 58 pages?

  • Fall '14
  • Control flow, d. pseudocode

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes