Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

you will be writing a more complex modular program that uses at least two loops, validates user input, and includes a test plan. As long

you will be writing a more complex modular program that uses at least two loops, validates user input, and includes a test plan.

As long as your program satisfies the requirements listed below, you are free to design and write any type of program that you care to. You are encouraged to be creative, and pick something that has meaning for you, because you'll have more fun. Feel free to create a more complex version of the program you did in an earlier lab, as long as it meets all of the additional requirements below.

Requirements

-Your lab submission should consist of a Python file, Lab.py, uploaded to the Lab Assignments folder, plus a document Lab4-TestPlan.doc (or docx) containing a test plan. The Lab.py file should meet all of the following requirements:

-A comment at the top with a brief description of the program, including Input List and Output List.

-Your name given as the author.

-Full pseudocode should be included in the comments.

-It must have at least one input and at least one output.

-It must validate all user input. This means the user is not allowed to just enter any value. You must check the value, ask the user to enter it again if the entry is invalid, and repeat this loop until the user enters a valid value. A user should not be able to produce a Python error by entering invalid input values - your -program should handle all invalid input with an error message and a re-prompt.

-Your program must use at least two loops in meaningful ways. The loops you use for input validation count for at most one of the two required loops. If you use loops to validate two separate inputs, that does not count as two loops for satisfying this lab requirement.

-It should be organized into separate modules (one module for input, one module for output, and one module for each separate calculation or action that the program is to perform [that is, each module should be "cohesive" and should only do one thing]).

-Use parameters and arguments to pass values into your modules (don't use global variables).

-The Python code should run correctly, and the logic should match your pseudocode.

-The test plan document Lab-TestPlan should meet all of the following requirements:

-Follow the format given in the example test plans (one below, and one on the Testing page). You can download and copy the test plan document below and use it as a template: replace the content of each section with your own content.

-Write the test plan as if for someone who cannot see your source code (utilize black-box testing). They can only run the program, provide inputs, and observe outputs.

-For each test case, include at least the following fields: Summary, Test Procedure, Test Data, Expected Result. Feel free to add more fields if you want to. (See Test Case for additional fields.)

-Include test cases for all important categories of input (valid, invalid, boundary, etc.). If your program passes every test case in your test plan, you should be confident that it functions correctly.

-Be sure to run your program against the test plan to determine its correctness, and fix any bugs found.

Please make sure to see the example and wtach the video too i want the same style of this __author__ = 'name ' # Book Club Points # Club Awards Points to Customer Based on the Number of # Books Purchased Each Month and Evaluate the Customers # Put the Customers in Categories Based on Points Earned # Input List: book # Output List: book, point, evaluation # # Function Integer book_number() # Declare Integer book # Display " please enter the number of books that you purchased this month" # Input book # Return book # End Function def book_number(): book = 0 book = int(input("please enter the number of books that you purchased this month ")) return book # Function Integer calculate_piont_earned ( Integer book_number) # Declare Integer point # If book_number == 0 Then # point = 0 # Else If book_number == 1 Then # point = 5 # Else If book_number == 2 Then # point = 15 # Else If book_number == 3 Then # point = 30 # Else If book_number > 3 Then # point = 60 # End If # Return point # End Function def calculate_point_earned(book_number): point = 0 if book_number == 0: point = 0 elif book_number == 1: point = 5 elif book_number == 2: point = 15 elif book_number == 3: point = 30 elif book_number > 3: point = 60 return point # Module output_category(Integer point_earned) # If point_earned == 0 Then # Display " The customer is in the first category" # Else If point_earned == 5 Then # Display " The customer is in the second category" # Else If point_earned == 15 Then # Display " The customer is in the third category" # Else If point_earned == 30 Then # Display "The customer is in the forth category" # Else If point_earned >30 Then # Display" The customer is in the final category" # End If # End Module def output_category (point_earned): if point_earned == 0: print("The customer is in the first category") elif point_earned == 5: print("The customer is in the second category") elif point_earned == 15: print(" The customer is in the third category") elif point_earned == 30: print("The customer is in the forth category") elif point_earned > 30: print("The customer is in the final category") # Function String final_valuation(Integer point_earned) # Declare String evaluation # If point_earned < 15 Then # Set evaluation = "Not a regular customer" # Else # Set evaluation = "A regular customer" # End If # Return evaluation # End Function def final_evaluation(point_earned): evaluation = "" if point_earned < 15: evaluation = "Not a regular customer" else: evaluation = "A regular customer" return evaluation # Module output_point( Integer book_number , Integer point_earned, String final_evaluation) # # Display " The number of books that the customer bought is ", book_number # Display " The point earned is", point_earned # Display " The final evaluation is", final_evaluation # End Module def output_point(book_number, point_earned, final_evaluation): print("The number of books that the customer bought is ", book_number) print(" The point earned is", point_earned) print("The final evaluation is", final_evaluation) # Module main # Declare Integer book # Declare Integer point # Declare String evaluation # # Set book = book_number() # set point = point_earned(book) # Set evaluation = final_evaluation(point) # Call output_point(book,point,evaluation) # Call output_category(point) # End Module def main(): book = 0 point = 0 evaluation = "" book = book_number() point= calculate_point_earned(book) evaluation = final_evaluation(point) output_point(book,point,evaluation) output_category(point) main() make sure to watch this video first https://www.youtube.com/watch?v=O-PanlMU3hY

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions