Flowgorithm SDEV 140 / Introduction to Software Development
Flowgorithm
SDEV 140 / Introduction to Software Development
S07 Flowgorithm Assignment / Chapter 7: Input Validation (15 points)
(From Programming Exercise 2, page 281)
INTRODUCTION: Download this document (S07 Flowgorithm Assignment.docx) from Blackboard, save it on your computer (in a folder that you can easily locate), and then open it in Word.
PREREQUISITE: You need to have the Flowgorithm program installed. Refer to S02 Flowgorithm Assignment if you have not done this already.
TASKS: This assignment is taken from Programming Exercise 2 on page 281 in Chapter 7 of the textbook. In this program, you will:
- Create a Flowgorithm program from a problem description
- Ask the user for the number of tickets sold in three different sections
- Validate that the number of tickets does not exceed the number of seats for each section
- Multiply the number of tickets sold times the cost for tickets in each section, add the totals for the three sections, and display the total amount of income from the ticket sales.
ASSIGNMENT: Start Flowgorithm, and then do the assignment outlined in step 2. Save the Flowgorithm file on your flash drive or PC as S07.fprg. Submit the Flowgorithm file in Blackboard.
- Create a Flowgorithm program as follows:
- Enter the required comment lines for Author, Date and Description.
- Declare Integer variables for number of tickets ordered, and the maximum number of tickets available in Section A, Section B, and Section C. Assign values for the maximum tickets in each section. Declare Real variables for the cost of tickets in Sections A, B and C, and assign values for those costs. Declare a Real variable for the total sales, and initialize it to 0.
- Ask the user for the number of tickets sold in Section A, and use a validation loop that iterates if the number entered is less than 0, OR greater than the maximum available for Section A. (You can use the word OR, or two vertical bars || ). Inside the loop, display an error message telling the user to enter a number between 0 and the maximum for that section, then prompting them again. (You can copy and paste the Output prompt and Input shapes just above the loop.)
- On the False branch of the loop, multiply the number of tickets ordered by the cost of tickets for that section, and add that amount to the total sales.
- Repeat steps c and d for Sections B and C. You can use Copy and Paste for your loops and calculations, but be sure to edit references from Section A to apply to Sections B and C.
- Save the file as S07.fprg.
- Run the program. The program should ask you to enter the number of tickets sold in Sections A, B and C. If any number is less than 0, or higher than the maximum number of tickets for that section, an error message is displayed until a valid number is entered. The program then displays the total amount of income from tickets sales. If there are any errors, recheck the instructions and correct them, then resave the file.
- Submit the Flowgorithm file S07.fprg by clicking on the View/Complete Assignment link in Blackboard, and attaching the file.DEBUGGING THE PROGRAM: One of the greatest skills a programmer can develop is debugging, which means locating and fixing errors in a program. Email your instructor and ASK QUESTIONS if you are having trouble. Please attach your Flowgorithm file (S07.fprg) to your email.CHECKLIST FOR SUBMITTING THE ASSIGNMENT:
- You have tested the Flowgorithm program (S07.fprg) and it works correctly
- Then, Attach the Flowgorithm file (S07.fprg) and Submit it through Blackboard
Answers
Status NEW
Posted 29 Apr 2017 05:04 AM
My Price 11.00
-----------
Not Rated(0)