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

Aau Catalog

...Office Technology** HIM208: Electronic Health Information Management **Course has prerequisite requirement Potential job opportunities: Medical Biller Semester Credits 3 3 4 3 4 17 Medical Coding CIP Code: 51.0713 ENG160: English Composition 1** HIT107: Medical Terminology BIO106: Anatomy and Physiology** HIT260: Basic Diagnostic Coding** HIT270: Basic Procedural Coding I** HIT280: Basic Procedural Coding II** **Course has prerequisite requirement Potential job opportunities: Medical Coder Semester Credits 3 3 4 3 3 3 19 101 5/8/13 RETURN TO TABLE OF CONTENTS COMPUTER INFORMATION SYSTEMS Computer Programming CIP Code: 11.0201 CIS105: Intro to Computer Science CIS110: Introduction to Computer Programming** CIS115: Introduction to Programming with Visual Basic** CIS210: Computer Organization** ISY101: Intro to Computer Systems MAT105: Basic College Mathematics **Course has prerequisite requirement Potential job opportunities: Computer Programmer Semester Credits 3 3 3 3 3 3 18 Computer Applications CIP Code: 11.0601 ISY101: Intro to Computer Systems ISY102: MS Office Fundamentals ISY104: Microsoft Office Word ISY105: Microsoft Office PowerPoint ISY206: Microsoft Excel** MAT105: Basic College Mathematics Semester Credits 3 3 3 3 3 3 18 Potential job opportunities: Executive Assistant, Office Manager Web Design CIP Code: 11.0801 CIS105: Intro to Computer Science ISY301: Web Page Design I ** ISY302: Web Page Design II **......

Words: 52297 - Pages: 210

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

Form

...Students who have completed Arts and Sciences (General Education) courses at other postsecondary education institutions may have their courses evaluated for transfer credit. ECPI requires specific arts and sciences courses to support program and University core outcomes, and transfer credits are evaluated with those requirements in mind. Therefore, students may not be able to transfer all their previously earned credits in Arts and Sciences to ECPI University. Self-Integration courses All students are required to take FOR110 (Essentials for Success) or an equivalent orientation course, which helps students learn to use the learning resources available to them at ECPI. They may also take CIS106 (Introduction to Operating Systems) and CIS115 (Computer Applications) so that they are comfortable with using the technologies available to them at school and at work. Near the end of their academic careers, they take a Career Orientation course, where they learn a variety of professional skills, including how to complete an interview process successfully and how to prepare effective resumes for their career searches. www.ecpi.edu Page 114 ECPI UNIVERSITY Academic Policies ACADEMIC POLICIES The following academic policies apply to all students attending ECPI University. Additional policies for students pursing a graduate degree are included in this Catalog under the Graduate Program Policies. Students pursing health science programs in the ECPI University......

Words: 149595 - Pages: 599

Yuuki Yuuna wa Yuusha de Aru: Washio Sumi no Shou Movie 2 – Tamashii | Espionnage | Boyz 4 Now season 03 episode 21