Free Essay

Cis115

In: Computers and Technology

Submitted By drawer1111
Words 784
Pages 4
Week 7 iLab—Sales Tax
TCO 3: Given a simple problem, design and desk-check a solution algorithm requiring a modular design that is expressed in terms of pseudocode or program notes, input-process-output (IPO) analysis, and flow chart. * TCO 7: Given a program with logic errors that is intended as a solution to a simple problem, employ debugging diagnostics to remove and correct the errors.

TCO 8: Given a more complex problem, develop a complete solution that includes a comprehensive statement of the problem, complete program design, and program documentation.
Scenario

Your algorithm will write two functions called ComputeTotal( ) and ComputeTax( ).
ComputeTotal( ) will receive the quantity of items purchased, and the unit price of each item. It will return the total sales (quantity times price).
ComputeTax( ) will receive total sales as a number and the state as a string and return the amount of tax depending on the state. NJ requires 7% tax, FL requires 6% tax, and NY has 4% tax.
The main program will ask for the name of the customer and read the name in a variable called name. It will also ask for one of the three states listed above. It will ask for the number of items sold and the unit price of the item.
Main will then call ComputeTotal( ), passing the quantity and unit price. Main will then call ComputeTax( ), passing the state and the amount of sales and receive back the tax. Finally Main( ) will print out the total sales, the tax amount, and the total with taxes. For example, see below.
Enter the name of the customer: Jack
In which state (NY / NJ / FL) ? NJ
How many items were purchased?: 3
What was the unit price of the items?: 1.50

The total sales for Jack are $4.50
The tax amount is $0.32 based on a tax rate of 7.00%
The total with taxes is $4.82

Make sure you save the return values into an appropriate variable. Use formatted output to make the program more user friendly.

Be sure to think about the logic and design first (IPO chart, pseudocode, and flowchart), then code the Visual Basic program.

Rubric

Point distribution for this activity: Lab Activity | Document | Points possible | Points received | Variable list | 10 | | IPO chart | 10 | | Hierarchy chart | 10 | | Pseudocode | 10 | | Working program | 20 | | Total Points | 60 | |

1—Variable List With Data Type
List all variables you will use (use valid variable names). Indicate whether the data type is string, integer, or decimal, and so on.

2—IPO Model
List the inputs, any processes/calculations, and the outputs. Use the same valid variable names you used in Step 1.

Inputs | Process (calculations) | Outputs | | | |

3—Hierarchy Chart
Use MS Visio to create a hierarchy chart. Paste the hierarchy chart here, or attach it as a separate document.

4—Pseudocode
Describe your solution using pseudocode. Use the same valid variable names you selected in Step 1.

5—Visual Basic Code
Screenshot of Running Program
Zipped Project File (submitted to DropBox)

Copy/paste your Visual Basic code here.

Module Module1

Sub Main()

Dim name, state As String

Dim quantity_of_items As Double

Dim unit_price, total_sales, tax_rate, total_tax As Double

Console.Write("Enter the name of the customer:")

name = Console.ReadLine()

Console.Write("In which state (NY / NJ / FL) ?")

state = Console.ReadLine()

Console.Write("How many items were purchased?:")

quantity_of_items = Val(Console.ReadLine())

Console.Write("What was the unit price of the items?:")

unit_price = Val(Console.ReadLine())

total_sales = ComputeTotal(quantity_of_items, unit_price)

Console.WriteLine(vbNewLine & "The total sales for " & name & " are " & total_sales.ToString("c2"))

total_tax = ComputeTax(total_sales, state)

If (state = "NJ") Then

tax_rate = 7

ElseIf (state = "FL") Then

tax_rate = 6

ElseIf (state = "NY") Then

tax_rate = 4

Else

Console.WriteLine("You Enter Worng State")

Console.ReadKey()

Environment.Exit(1)

End If

Console.WriteLine("The tax amount is " & total_tax.ToString("C2") & " based on a tax rate of " & tax_rate.ToString("0.00") & "%")

Console.WriteLine("The total with taxes is " & (total_sales + total_tax).ToString("c2"))

Console.ReadKey()

End Sub

Function ComputeTotal(ByVal quantity_of_items As Double, ByVal unit_price As Double)

Dim total_sale As Double

total_sale = quantity_of_items * unit_price

Return total_sale

End Function

Function ComputeTax(ByVal total_sale As Double, ByVal state As String)

Dim tax_rate, tax As Double

If (state = "NJ") Then

tax_rate = 7

ElseIf (state = "FL") Then

tax_rate = 6

ElseIf (state = "NY") Then

tax_rate = 4

Else

Console.WriteLine("You Enter Worng State")

Console.ReadKey()

Environment.Exit(1)

End If

tax = tax_rate * total_sale / 100

Return tax

End Function

End Module

Paste a screenshot(s) of the complete working program here. Use test scenarios to test all possible paths of execution.

Submit a separate zipped file to the Dropbox containing the complete project folder.

Similar Documents

Premium Essay

Cis115

...Week 2 Activity—Game Seating Charges ------------------------------------------------- TCO 2—Given a simple problem, design a solution algorithm that uses arithmetic expressions and built-in functions. Assignment Your goal is to solve the following simple programming exercise. You have been contracted by a local stadium to design an algorithm determining the total seating charges for any game held at the stadium. Lower level seats cost $25 per seat, midlevel seats cost $15 per seat, and upper level seats cost $10 per seat. The algorithm should ask the user for the number of seats being purchased in each seating level. Then, the algorithm will determine the total for each level and a grand total for the entire purchase. Be sure about the logic and design first (IPO chart, flowchart, and pseudocode). Advanced (optional): Use constants for the per-seat cost for each level. Rubric Complete the steps and submit the completed file to the Dropbox. 1) Variable list 2) IPO chart 3) Flowchart 4) Pseudocode 5) Desk-check Game Seating Charges | Document | Points possible | Points received | Variable list | 4 | | IPO chart | 4 | | Flowchart | 4 | | Pseudocode | 4 | | Desk-check | 4 | | Total Points | 20 | | 1) Variable List List all the variables you will use (use valid variable names). Indicate whether the data type is string, integer, or double, and so on. lowerLevelSeatQuantity Integer lowerLevelAmount Real......

Words: 707 - Pages: 3

Premium Essay

Aau Catalog

...ALLIED AMERICAN UNIVERSITY Personalized. Flexible. Dedicated. Online Programs – Individual Support – Open Enrollment – Ease of Transfer Credits UNIVERSITY CATALOG 2013 Seventh Edition 22952 Alcalde Drive, Laguna Hills, CA 92653 Phone: (888) 384-0849 ∼ Fax: (949) 707-2978 7:00 A.M. – 5:00 P.M. (Monday – Friday) Email: info@allied.edu Website: www.allied.edu KEY STAFF AND FACULTY Charlotte Hislop, Ph.D. Candidate, President/CEO Bonny Nickle, Ed.D., Provost Eric Sharkey, M.Ed., Director of Education Bill Luton, Ph.D., Director of Assessment and Dean of Business Carlo Tannoury, Ph.D. Candidate, Dean of Computer Information Systems Patricia Drown, Ph.D., Dean of Criminal Justice and General Studies C.J. Bishop, M.B.A., Institutional Research Frank Vazquez, Operations Director Parrish Nicholls, J.D., Director of Compliance Lindsay Oglesby, Admissions Director Abby Dolan, B.A., Registrar Sasha Heard, M.B.A., Student Services Manager Barbara Jobin, B.S.B.A., Career Center Manager Hugo Aguilar, B.A., Chief Financial Officer Richard Madrigal, B.A., Financial Aid Officer As a prospective student at Allied American University, you are encouraged to review this catalog prior to signing an enrollment agreement. You are also encouraged to review the student performance fact sheet which must be provided to you prior to signing an enrollment agreement. This catalog is not a contract between the student, AAU, or any party or parties. Reasonable effort was made at the time this......

Words: 52297 - Pages: 210

Premium Essay

Form

...OFFICIAL CATALOG This Catalog contains information, policies, procedures, regulations and requirements that were correct at the time of publication and are subject to the terms and conditions of the Enrollment Agreement entered into between the Student and ECPI University. In keeping with the educational mission of the University, the information, policies, procedures, regulations and requirements contained herein are continually being reviewed, changed and updated. Consequently, this document cannot be considered binding. Students are responsible for keeping informed of official policies and meeting all relevant requirements. When required changes to the Catalog occur, they will be communicated through catalog inserts and other means until a revised edition of the Catalog is published. The policies in this Catalog have been approved under the authority of the ECPI University Board of Trustees and, therefore, constitute official University policy. Students should become familiar with the policies in this Catalog. These policies outline both student rights and student responsibilities. The University reserves the right and authority at any time to alter any or all of the statements contained herein, to modify the requirements for admission and graduation, to change or discontinue programs of study, to amend any regulation or policy affecting the student body, to increase tuition and fees, to deny admission, to revoke an offer of admission and to dismiss from......

Words: 149595 - Pages: 599