Presentation is loading. Please wait.

Presentation is loading. Please wait.

EXERCISE IN CLASS CHAPTER 2. PART 1 SEQUENCE SCENARIO 1 Write an algorithm for a C program, that prompts user to enter total number of umbrellas he/she.

Similar presentations


Presentation on theme: "EXERCISE IN CLASS CHAPTER 2. PART 1 SEQUENCE SCENARIO 1 Write an algorithm for a C program, that prompts user to enter total number of umbrellas he/she."— Presentation transcript:

1 EXERCISE IN CLASS CHAPTER 2

2 PART 1 SEQUENCE

3 SCENARIO 1 Write an algorithm for a C program, that prompts user to enter total number of umbrellas he/she wants to buy. Price of one umbrella is RM3.00. This program will calculates and displays total price of these umbrellas to user.

4 SCENARIO 2 Write an algorithm for a program that capable to calculate and displays sum of three numbers. All numbers will be entered by user.

5 PART 1 SELECTION

6 SCENARIO 1 Write an algorithm for below scenario: Ask user to enter weight. Program will only displays status “You’re obese” if the weight is more than 100kg.

7 SCENARIO 2 Write an algorithm for a program that will calculate discount, based on the quantity of book purchased. 10% discount will be given if customer pays for more than 50 books, where cost of each book is RM20.00. Display total price to user.

8 SCENARIO 3 Modify question in scenario 1. Program will displays status based on below condition: weight >100kg, status=“Obese” weight < 30kg, status= “Underweight” others, status = “Normal”

9 SCENARIO 4 Ask the user to enter room code and number of days they want to stay. Identify the room type and room price based on the table given below: Code Type Price (RM) D Deluxe 200.00 T Twin Sharing 170.00 S Single 120.00 Display details of info to user.

10 PART 1 REPETITION

11 Write an algorithm for below scenario: Ask user to enter an alphabet. Display the alphabet up to 5 times. Using while loop, display the sum of values from 1 to 10. Display multiplication table for no 5 up to 10 values. Sample output: 5 10 15 20 25 30 35 40 45 50 SCENARIO 1

12 Prompt user to enter one word. Program will displays the word according to how many times he/she wants the word to be displayed. SCENARIO 2

13 SCENARIO 3 Create a system that will accept and displays even numbers. The system will only stop when the user enters an odd number. Develop a program to display a symbol up to 5 times. Ask user to enter “yes” keyword to run the program and a symbol for input. System will only stop if user enters other than “yes” keyword.

14 SCENARIO 4 Write a pseudo code for below program: Given, series of values : 1 2 3 4 and 5. Write a program that will displays values from highest to lowest or vice versa with regards to selection entered by user: enter 1 : to display highest to lowest enter 2 : to display lowest to highest others : displays “Wrong input”

15 THAT’S ALL FOR TODAY…… SEE YA NEXT CLASS


Download ppt "EXERCISE IN CLASS CHAPTER 2. PART 1 SEQUENCE SCENARIO 1 Write an algorithm for a C program, that prompts user to enter total number of umbrellas he/she."

Similar presentations


Ads by Google