MAKE FLOWCHART TO GO ALONG WITH IT  FLOWCHART EXAMPLE PROVIDED AS WELL AS MY CODE

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

PYTHON PROGRAMMING ONLY

NEED HELP MAKING A FLOWCHART TO GO ALONG WITH MY CODE 

MY CODE IS ALREADY DONE AND CORRECT JUST NEED TO MAKE FLOWCHART TO GO ALONG WITH IT 

FLOWCHART EXAMPLE PROVIDED AS WELL AS MY CODE 

QUESTION:

A retail company must file a monthly sales tax report listing the total sales for the month,
and the amount of state and county sales tax collected. The state sales tax rate is 5 percent
and the county sales tax rate is 2.5 percent. Write a program that asks the user to enter
the total sales for the month. From this figure, the application should calculate and display
the following:
• The amount of county sales tax
• The amount of state sales tax
• The total sales tax (county plus state)

MY CODE:

# Function to validate input as a positive float
def get_valid_float(prompt):
while True:
try:
value = float(input(prompt))
if value >= 0:
return value
else:
print("Please enter a positive value.")
except ValueError:
print("Invalid input. Please enter a valid number.")

# Constants for tax rates
STATE_TAX_RATE = 0.05
COUNTY_TAX_RATE = 0.025

# Get the total sales from the user
total_sales = get_valid_float("Enter the total sales for the month: $")

# Calculate the county and state sales tax
county_sales_tax = total_sales * COUNTY_TAX_RATE
state_sales_tax = total_sales * STATE_TAX_RATE
# Calculate the total sales tax
total_sales_tax = county_sales_tax + state_sales_tax

# Display the results
print(f"County Sales Tax: ${county_sales_tax:.2f}")
print(f"State Sales Tax: ${state_sales_tax:.2f}")
print(f"Total Sales Tax: ${total_sales_tax:.2f}")

### Function Returning Boolean Values

#### Continuous Summing Function Example Flowchart

This educational module presents a flowchart designed to illustrate a function returning Boolean values for a continuous summing operation. Below is a detailed explanation of each component in the flowchart.

1. **Check and Continue Function:**
   - **Start Point:** The process initiates with a prompt to check and continue.
   - **Decision Making:** 
     - Checks input text in a loop (`while True`).
     - If the response is "yes," it returns `True`.
     - If the response is "no," it returns `False`.
     - Any other input leads to a printout of "Invalid input," and the loop continues.

2. **Get and Check Positive Integer Function:**
   - **Start Point:** The function begins by getting user input through a prompt for a positive integer.
   - **Decision Making:**
     - Continues in a loop (`while True`).
     - Validates if the input is numeric and greater than 0.
     - If valid, it returns the integer value.
     - If invalid, it prints "Invalid input" and reiterates.

3. **Main Function:**
   - **Initialization:** 
     - Sets variables `sum = 0` and `cont = True`.
   - **Loop:** Continues as long as `cont` is `True`.
     - Calls the `get_and_check_positive_integer` function to retrieve a valid number.
     - Adds the number to `sum`.
     - Calls `check_continue` to determine if another number should be added.
     - If the response is "no," it prints the sum and ends the process.
     - If the response is "yes," it continues the loop to add another number.

This flowchart provides a clear, step-by-step visual guide to implementing a simple program logic for continuously summing positive integer inputs until an exit condition is met.
Transcribed Image Text:### Function Returning Boolean Values #### Continuous Summing Function Example Flowchart This educational module presents a flowchart designed to illustrate a function returning Boolean values for a continuous summing operation. Below is a detailed explanation of each component in the flowchart. 1. **Check and Continue Function:** - **Start Point:** The process initiates with a prompt to check and continue. - **Decision Making:** - Checks input text in a loop (`while True`). - If the response is "yes," it returns `True`. - If the response is "no," it returns `False`. - Any other input leads to a printout of "Invalid input," and the loop continues. 2. **Get and Check Positive Integer Function:** - **Start Point:** The function begins by getting user input through a prompt for a positive integer. - **Decision Making:** - Continues in a loop (`while True`). - Validates if the input is numeric and greater than 0. - If valid, it returns the integer value. - If invalid, it prints "Invalid input" and reiterates. 3. **Main Function:** - **Initialization:** - Sets variables `sum = 0` and `cont = True`. - **Loop:** Continues as long as `cont` is `True`. - Calls the `get_and_check_positive_integer` function to retrieve a valid number. - Adds the number to `sum`. - Calls `check_continue` to determine if another number should be added. - If the response is "no," it prints the sum and ends the process. - If the response is "yes," it continues the loop to add another number. This flowchart provides a clear, step-by-step visual guide to implementing a simple program logic for continuously summing positive integer inputs until an exit condition is met.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Concept of Flowchart
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education