0% found this document useful (0 votes)
2 views

ITC Lab 08

This document provides an introduction to using Flowgorithm for designing functions in programming. It includes step-by-step instructions for creating, editing, and calling functions, along with several lab tasks that require drawing flowcharts for various programming problems such as checking even or odd numbers, calculating factorials, and managing bank accounts. Additionally, it outlines tasks involving mean and standard deviation calculations, fitness center membership cost determination, and simulating a coin toss.

Uploaded by

sanamre143ucp
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

ITC Lab 08

This document provides an introduction to using Flowgorithm for designing functions in programming. It includes step-by-step instructions for creating, editing, and calling functions, along with several lab tasks that require drawing flowcharts for various programming problems such as checking even or odd numbers, calculating factorials, and managing bank accounts. Additionally, it outlines tasks involving mean and standard deviation calculations, fitness center membership cost determination, and simulating a coin toss.

Uploaded by

sanamre143ucp
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Introduction to Computing

Lab 08
Topic Flowgorithm
Flowgorithm
Objective
 Functions
Designing a Function
Go to function manager:

A function manager window will pop up:


Click on Add Buton

Type Function name

Click on ok
Click on Done

Check the
function menu

Design the function:


Call the function:

Parameters of a function:
Edit the add() function:
Go to function manager, select the function and click on the edit button
Click on add button to add parameters:

Redefine the function:

Returning the value from a function:


Edit the add() function and select the return type:
Now the calling of the function must be done in the assign or output box to see
the result on the console:
Lab task
Pattern Printing
Task 1: Even or Odd
Draw a flowchart to check if a number is even or odd. Design a function called
check_even_odd and call it in the main flowchart.

Task 2: Calculate Factorial


Draw a flowchart to calculate the factorial of a number. Implement a function
calculate_factorial() that uses a loop to compute the result.

Task 3: Prime Number


Draw a flowchart to check if a number is prime or not. Design a function named isprime().

Sample Input/Output:
Enter a number: 4 [Press Enter]
4 is not a prime number

Task 4: Bank Account


Draw a flowchart for a bank account management system with the following functionalities:
o Check balance
o Deposit money
o Withdraw money (ensure sufficient balance)
Implement the flowchart using separate functions for each feature. Use a main menu to
allow users to interact with the program.

Sample Input/Output:
Welcome to the Bank System
1. Check Balance
2. Deposit Money
3. Withdraw Money
Enter your choice: 2 [Press Enter]
Enter amount to deposit: 500 [Press Enter]
Your new balance is: 1500

Task 5: Mean and Standard Deviation


Draw a flowchart that inputs five numbers and outputs the mean (average) and standard
deviation of the numbers. If the numbers are x1, x2, x3, x4, and x5, then the mean is x = (x1
+ x2 + x3 + x4 + x5)/5 and the standard deviation is:
Design the following functions: a function that calculates and returns the mean and a
function that calculates the standard deviation

Task 6: Fitness Center Membership


The cost to become a member of a fitness center is as follows:
(a) Senior citizens discount is 30%
(b) If membership is bought and paid for 12 or more months, the discount is 15%
(c) If more than five personal training sessions are bought and paid for, the discount on each
session is 20%.
Design a menu-driven flowchart that determines the cost of a new membership. Your
program must contain:
1. a function that displays general information about the fitness center and its charges
2. a function to get all the necessary information to determine the membership cost
3. a function to determine the membership cost.
Use appropriate parameters to pass information in and out of a function.

Task 7: Coin Toss


Design a function named coinToss that simulates the tossing of a coin. When you call the function, it
should generate a random number in the range of 1 through 2. If the random number is 1, the
function should display “heads.” If the random number is 2, the function should display “tails.”
Demonstrate the function in a program that asks the user how many times the coin should be
tossed, and then simulates the tossing of the coin that number of times.

Hint: You can use Random() function.

You might also like