LAB SESSION 5 STRUCT WITH FUNCTION 1. QUESTION 1 Given a struct definition: struct athleteRec { char name[30]; int age; char IC_number[20]; int score_event1;

Slides:



Advertisements
Similar presentations
Inventory Management & Administration System Tourism suite A powerful computer software application handling carefully your inventory department activity.
Advertisements

COST MANAGEMENT Movement Management. COST MANAGEMENT Cost Management is accessible on the Movement level from MANAGE MOVEMENT page 2 nd Level Navigation.
Functions Prototypes, parameter passing, return values, activation frams.
Create a data flow diagram
START DEFINITIONS values (3) N1 = (8, 1,-9) i N1 average N3,2 sum N2 = 0 temp N1 Do not guess or assume any values! Follow the values of the variables.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 4- 1 ; Programmer-Defined Functions Two components of a function definition.
Math operators and a challenge Mastery Objectives: Students will— Be able to use augment assignment operators Demonstrate proficiency in using types, variables.
Unit 7: Consumer Skills Section 3: Buying a Car. I CAN Apply each of the following to the purchase of a car: ▫Acceptance ▫Cash Value ▫Counteroffer ▫Face.
Software Development Method. Assignments Due – Homework 0, Warmup Reading – Chapter 2 –
1 CS 105 Lecture 10 Functions Version of Mon, Mar 28, 2011, 3:13 pm.
1 11/8/06CS150 Introduction to Computer Science 1 Arrays Chapter 8 page 477 November 13, 2006.
1 Lab Assignment#5 Due 12/7 A car can hold 12 gallons of gasoline and it can travel 360 miles without refuelling. Write a program the displays the trip.
1 Lab Session-6 CSIT-121 Spring 2005 Structured Choice The do~While Loop Lab Exercises.
12.2 Cash and Trade Discounts
1 Lab Session-7 CSIT-121 Fall Introducing Structured Choice 4 The do~While Loop 4 Lab Exercises.
Selection in C.
1 10/30/06CS150 Introduction to Computer Science 1 Functions Chapter 3, page 313.
ISI Request For Quote Integrates with Microsoft Dynamics GP Inventory, Purchase Order Processing and Sales Order Processing Dynamics is a registered trademark.
McGraw-Hill/Irwin Introduction to QuickBooks Pro, 2004 © 2005 The McGraw-Hill Companies, Inc., All Rights Reserved. Chapter 7 Sales Tax.
Online Shopping and Credit Cards
Percent and Problem Solving: Sales Tax, Commission, and Discount
RealProperty PLUS Commercial I Escalations and Passthroughs © 2009 Domin-8 Enterprise Solutions LLC. All rights reserved.
Edited from Powerpoint Slides provided by Thomson Learning
5 Minute Check Complete in your notes. MegaMart collects a sales tax equal to 1/16 of the retail price of each purchase. The tax is sent to the government.
Copyright ©2005  Department of Computer & Information Science JavaScript Modularity.
Tax, tip, and Markup Notes and examples.
The Sweater Task To celebrate your birthday, your grandparents take you shopping. Which sale should you take advantage of if you want the best reduction.
CS 100 Introduction to Computing Seminar
1. 2 Sales tax is calculated by finding the percent of the total purchase.
6.01 Inventory Control Methods
MARKUP. The difference in the amount that a store charges compared to what the store paid How much a store raises the price to make a profit. Markup =
Program #2 Algorithm for Parking at PSU. Understanding the Assignment You will be writing a program to find out how much someone at PSU might be spending.
An Introduction to Programming with C++ Sixth Edition Chapter 10 Void Functions.
Using variable Variables are used to store values.
Controls Part 2. DateTimePicker Control Used for representing Date/Time information and take it as input from user. Date information is automatically.
LAB SESSION ONE DIMENSIONAL ARRAY.
Percent of Change. Objective: To find the sale price of various items. To use the percent of change formula to find discount.
Chapter 8 Arrays. A First Book of ANSI C, Fourth Edition2 Introduction Atomic variable: variable whose value cannot be further subdivided into a built-in.
© The McGraw-Hill Companies, 2006 Chapter 3 Iteration.
Programming Problems Intermediate 2 Computing SHOW YOUR TEACHER YOUR WORKING PROGRAM AND WRITING FRAME THEN SAVE IN YOUR PROGRAMMING FOLDER AND UPDATE.
Lab 9 Exercises.
For Friday Read No quiz Program 6 due. Program 6 Any questions?
Arrays. Arrays are objects that help us organize large amounts of information.
Functions Procedural Abstraction Flow of Control INFSY 307 Spring 2003 Lecture 4.
Lecture 10: Structures. Outline Introduction Structure Definitions and declarations Initializing Structures Operations on Structures members Structures.
Announcements. Practice questions, with and without solutions will be uploaded by Friday 5 th November, make sure to check them before the weekend \\netstorage\Subjects\ITCA-b\Exam.
CIS 115 All Exercises Devry University (Devry) For more course tutorials visit CIS 115 All Exercises Devry University.
Reports. Reports display information retrieved from a database in an attractive printed format. Reports can be created directly from tables, but More.
The Medical LAB Management System with Integrated Accounting.
Chapter 2 Page ref. Chapter 2 Customizing QuickBooks 53.
Problem solving Chapter 3
CIS 115 All Exercises Devry University (Devry) FOR MORE CLASSES VISIT CIS 115 All Exercises Devry University.
McGraw-Hill/Irwin Introduction to QuickBooks Pro, 2004 © 2005 The McGraw-Hill Companies, Inc., All Rights Reserved. Chapter 11 Customizing QuickBooks.
CIS 115 AID Teaching Effectively/cis115aid.com FOR MORE CLASSES VISIT
CIS 115 Slingshot Academy / cis115.com
6.01 Inventory Control Methods
Exercise : Write a program that print the final price of purchase at a store where everything costs exactly one dollar. Ask for the number of items purchased.
MT262A Review.
function definition How to build a color house with number bedrooms.
Value-Returning Functions
Algorithm development
CS 1430: Programming in C++.
For Monday Read WebCT quiz 18.
One-Dimensional Array Introduction Lesson xx
Topics discussed in this section:
Find Price or Tax.
Find Sales tax Statement.
Percent A fraction in which the denominator is 100. It is another name for hundredths. The symbol, “%,” means “out of 100.”
Review Lab assignments Homework #3
Final Project Abdullah’s Coffee Shop
Presentation transcript:

LAB SESSION 5 STRUCT WITH FUNCTION 1

QUESTION 1 Given a struct definition: struct athleteRec { char name[30]; int age; char IC_number[20]; int score_event1; int score_event2; int score_event3; int totalScore; } 2

QUESTION 1(CONTINUE) 1)Write a function definition that will : a) inputData() //input a data and return by value b) calcTotal() // calculate a total score and return through reference parameter c) calcAverage() //calculate an average of total score and return by value d) displayReport() // display a report as below: ***************************** ATHLETE DATA: Name : XXXXXXXXXXXX IC Number : XXXXXX-XX-XXXX Detail Score : Event 1 : XXXX Event 2 : XXXX Event 3: XXXX TOTAL SCORE : XXXXX AVERAGE SCORE : XXXX ***************************** 3

QUESTION 2 Write a C++ program to help a local restaurant owner to automate his/her breakfast billing system. The program should do the following tasks: Show the customer the different breakfast items offered by the restaurant. Allow the customer to select one item and the amount of item purchased from the menu. Calculate and print the bill. Assume that the restaurant offers the following breakfast items: 4 ItemsPrices/Unit Plain eggRM1.50 MuffinRM2.00 French toastRM2.50 Fruit BasketRM3.00

QUESTION 2(CONTINUE) Your program must contain at least the following functions: Function showMenu: this function shows the different items offered by the restaurant and tells the user how to select the items. Function CalculateTotal: this function calculates the total price to be paid by the customer. The total price should include a 5% tax. Function printCheck: this function prints the check. Your program should use a structure to store information about the customer’s purchase: menu item, item price, the amount of item, tax value and the total amount due. A sample output is as follows: Thanks for dining at Jonny’s Place Plain egg 2RM3.00 TaxRM0.15 Amount DueRM3.15 5

QUESTION 3(ASSIGNMENT 2) Afiqah’s Company want to automate their parking system. For the prototype, your program should input time in and time out for one car. The rate for the parking lot is given below: Your program must use a struct to store a data and apply modular programming. Sample of the output as below: Time In: pm Time Out : pm Charge : RM DetailCharge First 1 hourRM 2.00 Next each 1 hourRM 0.50 Maximum ChargeRM 10.00