PRACTICE SAC 1 Some solutions. 'inputs 'sale price 'postcode 'coupon codes 'processing 'calculate commissions (commission based on cost) 'calculate postage.

Slides:



Advertisements
Similar presentations
Midterm 26 March 2015 (4:30-5:30 pm) – Rm5620 Closed book exam MC Questions only x25 Up to L(7) Methods Scope: video lectures (+Lab), forum discussions,
Advertisements

Practical Programming COMP153-08S Lecture: Repetition Continued.
Control structures Part 2 iteration control To enable repetition of a statement block.
Multiple Forms & Procedures. Form Methods: –Show, Hide, Activate, Close Events: –Load, Activated, Closing, Closed.
Arrays One dimensional arrays. Index of projects Random picture display Sum array values Display names in listbox Name search Largest/smallest Car sales.
Chapter 7 – Control Structures A payroll company calculates the gross earnings per week of employees. Employees’ weekly salaries are based on the number.
Visual Basic Fundamental Concepts. Integrated Development Enviroment Generates startup form for new project on which to place controls. Features toolbox.
Visual Basic 2008 Express Edition The IDE. Visual Basic 2008 Express The Start Page Recent Projects Open an existing project Create a New Project.
3-1 Chapter 3 Variables, Assignment Statements, and Arithmetic.
COMPUTER PROGRAMMING I Objective 7.04 Apply Built-in String Functions (3%)
1 Visual Basic for Applications (VBA) for Excel Prof. Yitzchak Rosenthal.
1 Κατανεμημένες Διαδικτυακές Εφαρμογές Πολυμέσων Γιάννης Πετράκης.
1 Κατανεμημένες Διαδικτυακές Εφαρμογές Πολυμέσων Γιάννης Πετράκης.
Chapter 3 – Fundamentals of Programming in VB.NET VB.NET Controls VB.NET Events Numbers Strings Input and Output.
Lecture 8 Visual Basic (2).
COMPUTER PROGRAMMING I Objective 7.03 Apply Built-in Math Class Functions.
1 CC111 Lec9 : Visual Basic Visual Basic (3) Lecture 9.
VB Procedures. Procedures. Sub procedure: Private/Public Sub SubName(Arguments) … End Sub Private: Can only be accessed by procedures in the same form.
COMPUTER PROGRAMMING I SUMMER Apply operators and Boolean expressions.
VB Core II Conditional statements Exception handling Loops Arrays Debugging.
Programming Test #1 Solutions. Multiple Choice 1. B) the grammar of the coding language 2. C) String 3. A) Single 4. C) 2Burgers4Me 5. B) Design Time.
Visual Basic.NET Windows Forms Hello World Homework Assignment.
1 Week 6 The Repetition Structure. 2 The Repetition Structure (Looping) Lesson A Objectives After completing this lesson, you will be able to:  Code.
Tutorial 6 The Repetition Structure
Chapter 4 Looping Statements Adapted From: Starting Out with Visual Basic 2008 (Pearson)
IMS 3253: Subroutines 1 Dr. Lawrence West, MIS Dept., University of Central Florida Topics Procedures Subroutines Parameters –By Value.
CS0004: Introduction to Programming Project 1 – Lessons Learned.
6c – Function Procedures Lingma Acheson Department of Computer and Information Science, IUPUI CSCI N331 VB.NET Programming.
COMPUTER PROGRAMMING I SUMMER Apply operators and Boolean expressions.
3.2 VB.NET Events An Event Procedure Properties and Event Procedures of the Form Tab Order of Controls Exercises.
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 8 What’s Wrong with It?
1 Week 5 More on the Selection Structure. 2 Nested, If/ElseIf/Else, and Case Selection Structures Lesson A Objectives After completing this lesson, you.
1 Advanced Computer Programming Lab Calculator Project.
4-1 Chapter 4 The Selection Process in VB.NET. 4-2 Learning Objectives Understand the importance of the selection process in programming. Describe the.
COPYRIGHT 2010: Dr. David Scanlan, CSUS OBJECTIVES: How to write classes How to create an object from a class using the "New" keyword. How to communicate.
Problem Solving with Decisions
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 7 Where Can I Store This?
Created by Alia Al-Abdulkarim 2008 Visual Basic Vs. Java.
COMPUTER PROGRAMMING I SUMMER Apply operators and Boolean expressions.
6b – Sub Procedure With Parameters Lingma Acheson Department of Computer and Information Science, IUPUI CSCI N331 VB.NET Programming.
Using ADO.Net to Build a Login System Dr. Ron Eaglin.
© 2006 ITT Educational Services Inc. Introduction to Computer Programming: Unit 3: Chapter 3: Slide 1 Unit 3 Formatting Chapter 3 Input, Variables, Constants,
ADO.NET Objects Data Adapters Dr. Ron Eaglin. Agenda Builds on Information in Part I Should have working knowledge of creating a database connection Continuation.
مقدمة في البرمجة Lecture 7. Write VB.net project using the for loop to calculate : 1- the sum of numbers from 1 to (A) numbers. 2- the sum of Odd numbers.
Introduction to VB programming Dr. John P. Abraham UTPA Chapters 2 & 3.
MIC305 Week 6 Beyond controls Review of properties Differences with VB6: using classes and instances Programming constructs.
Addison Wesley is an imprint of © 2011 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Chapter 3 Variables and Calculations.
T HE W ALKING FOR W ATER P ROJECT IE 2060 Katelyn Cockrell Alexis Duran Theresa Garcia.
Visual Basic Declaring Variables Dim x as Integer = 0 In the statement above, x is being declared as an Integer (whole number) and is initialised.
Computer Science Up Down Controls, Decisions and Random Numbers.
Introduction to Programming Lecture 3 Msury Mahunnah, Department of Informatics, Tallinn University of Technology.
Use TryParse to Validate User Input
Visual Basic Fundamental Concepts
5.03 Apply operators and Boolean expressions
Objective 7.04 Apply Built-in String Functions (3%)
UNIT 5 Lesson 15 Looping.
Objective 7.03 Apply Built-in Math Class Functions
Apply Procedures to Develop Message, Input, and Dialog Boxes
Use TryParse to Validate User Input
Click here for the answer. Click here for the answer.
Click here for the answer. Click here for the answer.
Click here for the answer. Click here for the answer.
Introduction to VB programming
للمزيد زورونا على موقعنا الإلكتروني:
Chapter#9: A Deeper Look In Controls
Visual Basic..
Boolean Expressions and If statements
1.الدوال Function 2.الاجراءاتSub Procedure 3.وحده نمطيه Add Module
Part 2 Saving the Dictionary
Challenge Guide Grade Code Type Slides
Presentation transcript:

PRACTICE SAC 1 Some solutions

'inputs 'sale price 'postcode 'coupon codes 'processing 'calculate commissions (commission based on cost) 'calculate postage and handling (minus discount based on region) 'calculate various discounts (minusing the different type of discount) 'calculate final cost (involving summing all the costs) 'output: final price 'Memory ' 'saleprice double/single 'commission double/single 'postage 'discount 'finalcost

On event click update cost 'calculate commission with coupon discount 'create commission variable and start with zero value 'commission = saleprice*0.125 'if coupon textbox contains "SMALLCOMMS" then 'commission = commission*0.05 'end if 'finalcost = finalcost + commission 'calculate postage with coupon discount 'create commision variable and start with zero value 'if postage textbox contains < 999 'postage = 25 'else if postage textbox >= 999 and less then 1999 'postage = 15 End if 'if coupon textbox = "FREEPOST" 'postage = 0 'calculate final price with coupon discount 'create variable finalcost and start with zero value 'finalcost = saleprice + commission + postage 'if coupon textbox = "BIGSALE" 'finalcost = finalcost - finalcost*0.10 End if End sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdate.Click Dim commission, saleprice, postcode, postage, finalcost As Double 'create commission variable and start with zero value commission = saleprice * If txtCoupon.Text = "SMALLCOMMS" Then commission = saleprice * 0.5 End If ‘handling the input saleprice = txtSalePrice.Text postcode = CInt(txtPost.Text) 'calculate postage with coupon discount If postcode < 999 Then postage = 25 ElseIf postcode >= 999 & postcode < 1999 Then postage = 15 ElseIf postcode >= 1999 & postcode < 2999 Then postage = 15 ElseIf postcode >= 2999 & postcode < 3999 Then postage = 12 End If If txtCoupon.Text = "FREEPOST" Then postage = 0 End If 'calculate final price with coupon discount finalcost = saleprice + commission + postage If txtCoupon.Text = "BIGSALE" Then finalcost = finalcost - finalcost * 0.1 End If 'transfer answer to output txtFinalCost.Text = finalcost End Sub

Data Dictionary Variable NameData typeScopeDefault ValueDescription salepriceDoubleLocal100Stores sales PostcodeDoubleLocal3173Stores the postcode postageDoubleLocal0Postage cost that will be choosen Final CostDoubleLocal0The final cost will be accumulated here CommissionDoubleLocal0The commission in here

Other things to cover next week Testing Table Evaluation Criteria Object Descriptor