SlideShare a Scribd company logo
left0UNIVERSITI TUN HUSSEIN ONN MALAYSIA<br />FACULTY OF MECHANICAL AND MANUFACTURING ENGINEERING <br />BTI 1022: COMPUTER PROGRAMMING<br />LAB EXERCISE 6 Selection and loop<br />Exercise 1:<br />Write a C programme for Holiday Villa Subang Jaya Business Lounge internet charges that calculates the total charges for internet usage. Operation time: 08:00-22:00 and the charges are as follows:<br />HoursRateFirstRM 3.00Second to FifthRM 2.00Subsequence RM 1.00<br />Allow the user to repeat calculations as many times as needed and enter ‘n’ to stop. The output should similar as follow:<br />Exercise 2:<br />Write a C program to draw a symmetrical triangle by using for-loop. The program should be able to produce output as follows: <br />Exercise 3:<br />Write a C program to compute bill payment of electrical consumption for different users. In order to promote saving, Tenaga National Berhad (TNB) charge a lower rate to users with lower consumption as shown in table below. Hint:Break down to basic: Input; Switch; If-Else; calculations; While or Do-while loop. The program calculation and output similar as follows:<br />User  CodeUser typeFirst RateSecond rate1HouseholdRM0.10 for first 500 unitRM 0.25 for the following units2OfficeRM 0.25 for first 1000 unitRM0.50  for the following units3FactoryRM 0.50 for first 1500 unitRM 0.75 for the following units <br />
Bti1022 lab sheet 6

More Related Content

DOC
Mohamed-Hassan-CV (1)
EngMohamed hassan
 
PPTX
Assignment model
Dr. Soumendra Kumar Patra
 
PPTX
What are the causes of conflicts (Bahasa Malaysia)
alish sha
 
DOC
Lab 6
alish sha
 
DOCX
Dti2143 lab sheet 6
alish sha
 
PPTX
Dti2143 chapter 5
alish sha
 
DOCX
Dti2143 lab sheet 5
alish sha
 
PPTX
Matlab Script - Loop Control
Shameer Ahmed Koya
 
Mohamed-Hassan-CV (1)
EngMohamed hassan
 
Assignment model
Dr. Soumendra Kumar Patra
 
What are the causes of conflicts (Bahasa Malaysia)
alish sha
 
Lab 6
alish sha
 
Dti2143 lab sheet 6
alish sha
 
Dti2143 chapter 5
alish sha
 
Dti2143 lab sheet 5
alish sha
 
Matlab Script - Loop Control
Shameer Ahmed Koya
 

More from alish sha (20)

PPTX
T22016 – how to answer with ubs 9
alish sha
 
PPTX
July 2014 theory exam (theory)
alish sha
 
PPTX
Accounting basic equation
alish sha
 
PPTX
It 302 computerized accounting (week 2) - sharifah
alish sha
 
PPTX
It 302 computerized accounting (week 1) - sharifah
alish sha
 
DOC
Lab 9 sem ii_12_13
alish sha
 
DOCX
Lab 10 sem ii_12_13
alish sha
 
DOC
Lab 5 2012/2012
alish sha
 
DOCX
Purpose elaborate
alish sha
 
DOC
Lab sheet 1
alish sha
 
DOC
Test 1 alish schema 1
alish sha
 
DOC
Lab 6 sem ii_11_12
alish sha
 
PDF
Test 1 skema q&a
alish sha
 
PDF
Test 1 skema q&a
alish sha
 
DOC
Final project
alish sha
 
DOCX
Final project
alish sha
 
XLS
Attn list test
alish sha
 
PDF
Carry markdam31303
alish sha
 
DOCX
Final project
alish sha
 
DOCX
Final project
alish sha
 
T22016 – how to answer with ubs 9
alish sha
 
July 2014 theory exam (theory)
alish sha
 
Accounting basic equation
alish sha
 
It 302 computerized accounting (week 2) - sharifah
alish sha
 
It 302 computerized accounting (week 1) - sharifah
alish sha
 
Lab 9 sem ii_12_13
alish sha
 
Lab 10 sem ii_12_13
alish sha
 
Lab 5 2012/2012
alish sha
 
Purpose elaborate
alish sha
 
Lab sheet 1
alish sha
 
Test 1 alish schema 1
alish sha
 
Lab 6 sem ii_11_12
alish sha
 
Test 1 skema q&a
alish sha
 
Test 1 skema q&a
alish sha
 
Final project
alish sha
 
Final project
alish sha
 
Attn list test
alish sha
 
Carry markdam31303
alish sha
 
Final project
alish sha
 
Final project
alish sha
 
Ad

Bti1022 lab sheet 6

  • 1. left0UNIVERSITI TUN HUSSEIN ONN MALAYSIA<br />FACULTY OF MECHANICAL AND MANUFACTURING ENGINEERING <br />BTI 1022: COMPUTER PROGRAMMING<br />LAB EXERCISE 6 Selection and loop<br />Exercise 1:<br />Write a C programme for Holiday Villa Subang Jaya Business Lounge internet charges that calculates the total charges for internet usage. Operation time: 08:00-22:00 and the charges are as follows:<br />HoursRateFirstRM 3.00Second to FifthRM 2.00Subsequence RM 1.00<br />Allow the user to repeat calculations as many times as needed and enter ‘n’ to stop. The output should similar as follow:<br />Exercise 2:<br />Write a C program to draw a symmetrical triangle by using for-loop. The program should be able to produce output as follows: <br />Exercise 3:<br />Write a C program to compute bill payment of electrical consumption for different users. In order to promote saving, Tenaga National Berhad (TNB) charge a lower rate to users with lower consumption as shown in table below. Hint:Break down to basic: Input; Switch; If-Else; calculations; While or Do-while loop. The program calculation and output similar as follows:<br />User CodeUser typeFirst RateSecond rate1HouseholdRM0.10 for first 500 unitRM 0.25 for the following units2OfficeRM 0.25 for first 1000 unitRM0.50 for the following units3FactoryRM 0.50 for first 1500 unitRM 0.75 for the following units <br />