Sovi.AI - AI Math Tutor

Scan to solve math questions

QUESTION IMAGE

follow these instructions to complete your assignment: 1. write a flowc…

Question

follow these instructions to complete your assignment: 1. write a flowchart (or pseudocode) and c code for a program that does the following: - declares variables with float (real) data types - assigns the tax rate = .08 - asks the user to enter the sales amount - computes the sales tax by multiplying the sales by the tax rate - displays the sales tax with the appropriate message - create an assignment statement that computes the total sales, including the tax amount. - output a final message along with the total sales amount - be sure to add comments throughout your program describing what is happening 2. review the output below to check your work. 3. paste the following three items into a word document (.docx): a. your flowchart in flowgorithm or pseudocode if you did not create a flowchart

Explanation:

Step1: Pseudocode

//Declare variables
float sales_amount, tax_rate = 0.08, sales_tax, total_sales;

//Prompt user for sales amount
print("Enter the sales amount:");
input(sales_amount);

//Compute sales tax
sales_tax = sales_amount * tax_rate;

//Display sales tax
print("The sales tax is: ", sales_tax);

//Compute total sales
total_sales = sales_amount + sales_tax;

//Output total sales
print("The total sales including tax is: ", total_sales);

Step2: C code

#include <stdio.h>
int main() {
    // Declare variables
    float sales_amount, tax_rate = 0.08, sales_tax, total_sales;
    // Prompt user for sales amount
    printf("Enter the sales amount: ");
    scanf("%f", &sales_amount);
    // Compute sales tax
    sales_tax = sales_amount * tax_rate;
    // Display sales tax
    printf("The sales tax is: %f
", sales_tax);
    // Compute total sales
    total_sales = sales_amount + sales_tax;
    // Output total sales
    printf("The total sales including tax is: %f
", total_sales);
    return 0;
}

Answer:

Pseudocode and C - code are provided above as per the requirements.