Lab 2: Modules This lab accompanies Chapter 3 of Starting Out with Programming Logic & Design. Name: ___________________________ – Lab 2.1 Algorithms This lab requires you to think about the steps that take place in a program by writing algorithms. Read the following program prior to completing the lab. 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 4 percent and the county sales tax rate is 2 percent. Write a program that asks the user to enter the total sales for the month. The application should calculate and display the following: The amount of county sales tax The amount of state sales tax The sales tax (county plus state) Step 1: Examine the following algorithm. Get the total sales for the month. Multiply the total sales by .04 to calculate the state sales tax. Multiply the total sales by .02 to calculate the county sales tax. Add the state tax and county tax to calculate the total sales tax. Display the calculated county tax, state tax, and total sales tax. Step 2: Given a total sales of $27,097, answer the following: What is the calculated tax? _________________1083.88______________________ What is the calculated county tax? ___________________541.94__________________ What is the calculated tax? _____________________1625.82__________________ Variable Name Purpose Declare Real totalSales Stores total sales the user inputs Declare real countyTax Stores county tax
Lab 2: Modules This lab accompanies Chapter 3 of Starting Out with Programming Logic & Design. Name: ___________________________ Lab 2.1 – Algorithms This lab requires you to think about the steps that take place in a program by writing algorithms. Read the following program prior to completing the lab. 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 4 percent and the county sales tax rate is 2 percent. Write a program that asks the user to enter the total sales for the month. The application should calculate and display the following: The amount of county sales tax The amount of state sales tax The sales tax (county plus state) Step 1: Examine the following algorithm. Get the total sales for the month. Multiply the total sales by .04 to calculate the state sales tax. Multiply the total sales by .02 to calculate the county sales tax. Add the state tax and county tax to calculate the total sales tax. Display the calculated county tax, state tax, and total sales tax. Step 2: Given a total sales of $27,097, answer the following: What is the calculated tax? _________________1083.88______________________ What is the calculated county tax? ___________________541.94__________________ What is the calculated tax? _____________________1625.82__________________ Variable Name Purpose Declare Real totalSales Stores total sales the user inputs Declare real countyTax Stores county tax
cs111-lab2.docx