SlideShare a Scribd company logo
1 of 2
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

Similar to Bti1022 lab sheet 6

H63ECH_1B_023799_OsamaAzim
H63ECH_1B_023799_OsamaAzimH63ECH_1B_023799_OsamaAzim
H63ECH_1B_023799_OsamaAzimOsama Azim
 
Digital Energy Meter Project Report
Digital Energy Meter Project ReportDigital Energy Meter Project Report
Digital Energy Meter Project ReportVijayananda Mohire
 
Prepaid Energy Meter Recharge And Monitoring Using App
Prepaid Energy Meter Recharge And Monitoring Using AppPrepaid Energy Meter Recharge And Monitoring Using App
Prepaid Energy Meter Recharge And Monitoring Using AppIRJET Journal
 
ELE2303 Assign 1 Page 1 ELE2303 Embedded Systems Design.docx
ELE2303 Assign 1  Page  1 ELE2303 Embedded Systems Design.docxELE2303 Assign 1  Page  1 ELE2303 Embedded Systems Design.docx
ELE2303 Assign 1 Page 1 ELE2303 Embedded Systems Design.docxjack60216
 
1. User InterfaceCreate a simple text-based user interface wher.pdf
1. User InterfaceCreate a simple text-based user interface wher.pdf1. User InterfaceCreate a simple text-based user interface wher.pdf
1. User InterfaceCreate a simple text-based user interface wher.pdfConceptcreations1
 
IRJET- Modelling and Control of Variable Frequency Drive using PLC and Ma...
IRJET-  	  Modelling and Control of Variable Frequency Drive using PLC and Ma...IRJET-  	  Modelling and Control of Variable Frequency Drive using PLC and Ma...
IRJET- Modelling and Control of Variable Frequency Drive using PLC and Ma...IRJET Journal
 
Implementing a Digital Stopwatch Using Basic Stamp2
Implementing a Digital Stopwatch Using Basic Stamp2Implementing a Digital Stopwatch Using Basic Stamp2
Implementing a Digital Stopwatch Using Basic Stamp2Vijay Elavunkal
 
Advance autonomous billing system in the EB meter with GSM technology
Advance autonomous billing system in the EB meter with GSM technologyAdvance autonomous billing system in the EB meter with GSM technology
Advance autonomous billing system in the EB meter with GSM technologyIRJET Journal
 
Technical manual - Omron
Technical manual - OmronTechnical manual - Omron
Technical manual - OmronSanjay Aj
 
Serial Switching in Interval Meters
Serial Switching in Interval MetersSerial Switching in Interval Meters
Serial Switching in Interval MetersRakesh Dasgupta
 
CONTROLLING PPT.pptx
CONTROLLING PPT.pptxCONTROLLING PPT.pptx
CONTROLLING PPT.pptxsaphana9800
 
IRJET- Automatic Mseb Meter Reading
IRJET- Automatic Mseb Meter ReadingIRJET- Automatic Mseb Meter Reading
IRJET- Automatic Mseb Meter ReadingIRJET Journal
 
Persentation slide Design emplementation and performance test of a prepaid en...
Persentation slide Design emplementation and performance test of a prepaid en...Persentation slide Design emplementation and performance test of a prepaid en...
Persentation slide Design emplementation and performance test of a prepaid en...Chand Siddique
 
ECESLU Microprocessors Lecture 3
ECESLU Microprocessors Lecture 3ECESLU Microprocessors Lecture 3
ECESLU Microprocessors Lecture 3Jeffrey Des Binwag
 
IRJET- Braille Oriented Classroom
IRJET-  	  Braille Oriented ClassroomIRJET-  	  Braille Oriented Classroom
IRJET- Braille Oriented ClassroomIRJET Journal
 
Destination reminder
Destination reminderDestination reminder
Destination reminderAshwin Bangar
 

Similar to Bti1022 lab sheet 6 (20)

H63ECH_1B_023799_OsamaAzim
H63ECH_1B_023799_OsamaAzimH63ECH_1B_023799_OsamaAzim
H63ECH_1B_023799_OsamaAzim
 
Digital Energy Meter Project Report
Digital Energy Meter Project ReportDigital Energy Meter Project Report
Digital Energy Meter Project Report
 
Prepaid Energy Meter Recharge And Monitoring Using App
Prepaid Energy Meter Recharge And Monitoring Using AppPrepaid Energy Meter Recharge And Monitoring Using App
Prepaid Energy Meter Recharge And Monitoring Using App
 
ELE2303 Assign 1 Page 1 ELE2303 Embedded Systems Design.docx
ELE2303 Assign 1  Page  1 ELE2303 Embedded Systems Design.docxELE2303 Assign 1  Page  1 ELE2303 Embedded Systems Design.docx
ELE2303 Assign 1 Page 1 ELE2303 Embedded Systems Design.docx
 
1. User InterfaceCreate a simple text-based user interface wher.pdf
1. User InterfaceCreate a simple text-based user interface wher.pdf1. User InterfaceCreate a simple text-based user interface wher.pdf
1. User InterfaceCreate a simple text-based user interface wher.pdf
 
Project Engineer
Project EngineerProject Engineer
Project Engineer
 
Resume
ResumeResume
Resume
 
The NC Machining Post-Processing Technology Based on UG
The NC Machining Post-Processing Technology Based on UGThe NC Machining Post-Processing Technology Based on UG
The NC Machining Post-Processing Technology Based on UG
 
IRJET- Modelling and Control of Variable Frequency Drive using PLC and Ma...
IRJET-  	  Modelling and Control of Variable Frequency Drive using PLC and Ma...IRJET-  	  Modelling and Control of Variable Frequency Drive using PLC and Ma...
IRJET- Modelling and Control of Variable Frequency Drive using PLC and Ma...
 
Implementing a Digital Stopwatch Using Basic Stamp2
Implementing a Digital Stopwatch Using Basic Stamp2Implementing a Digital Stopwatch Using Basic Stamp2
Implementing a Digital Stopwatch Using Basic Stamp2
 
Advance autonomous billing system in the EB meter with GSM technology
Advance autonomous billing system in the EB meter with GSM technologyAdvance autonomous billing system in the EB meter with GSM technology
Advance autonomous billing system in the EB meter with GSM technology
 
Technical manual - Omron
Technical manual - OmronTechnical manual - Omron
Technical manual - Omron
 
Serial Switching in Interval Meters
Serial Switching in Interval MetersSerial Switching in Interval Meters
Serial Switching in Interval Meters
 
CONTROLLING PPT.pptx
CONTROLLING PPT.pptxCONTROLLING PPT.pptx
CONTROLLING PPT.pptx
 
IRJET- Automatic Mseb Meter Reading
IRJET- Automatic Mseb Meter ReadingIRJET- Automatic Mseb Meter Reading
IRJET- Automatic Mseb Meter Reading
 
Persentation slide Design emplementation and performance test of a prepaid en...
Persentation slide Design emplementation and performance test of a prepaid en...Persentation slide Design emplementation and performance test of a prepaid en...
Persentation slide Design emplementation and performance test of a prepaid en...
 
ECESLU Microprocessors Lecture 3
ECESLU Microprocessors Lecture 3ECESLU Microprocessors Lecture 3
ECESLU Microprocessors Lecture 3
 
IRJET- Braille Oriented Classroom
IRJET-  	  Braille Oriented ClassroomIRJET-  	  Braille Oriented Classroom
IRJET- Braille Oriented Classroom
 
Destination reminder
Destination reminderDestination reminder
Destination reminder
 
Journal ishe
Journal isheJournal ishe
Journal ishe
 

More from alish sha

T22016 – how to answer with ubs 9
T22016 – how to answer with ubs 9T22016 – how to answer with ubs 9
T22016 – how to answer with ubs 9alish sha
 
July 2014 theory exam (theory)
July 2014 theory exam (theory)July 2014 theory exam (theory)
July 2014 theory exam (theory)alish sha
 
Accounting basic equation
Accounting basic equation Accounting basic equation
Accounting basic equation alish sha
 
It 302 computerized accounting (week 2) - sharifah
It 302   computerized accounting (week 2) - sharifahIt 302   computerized accounting (week 2) - sharifah
It 302 computerized accounting (week 2) - sharifahalish sha
 
It 302 computerized accounting (week 1) - sharifah
It 302   computerized accounting (week 1) - sharifahIt 302   computerized accounting (week 1) - sharifah
It 302 computerized accounting (week 1) - sharifahalish sha
 
Lab 9 sem ii_12_13
Lab 9 sem ii_12_13Lab 9 sem ii_12_13
Lab 9 sem ii_12_13alish sha
 
Lab 10 sem ii_12_13
Lab 10 sem ii_12_13Lab 10 sem ii_12_13
Lab 10 sem ii_12_13alish sha
 
Lab 5 2012/2012
Lab 5 2012/2012Lab 5 2012/2012
Lab 5 2012/2012alish sha
 
Purpose elaborate
Purpose elaboratePurpose elaborate
Purpose elaboratealish sha
 
Test 1 alish schema 1
Test 1 alish schema 1Test 1 alish schema 1
Test 1 alish schema 1alish sha
 
Lab 6 sem ii_11_12
Lab 6 sem ii_11_12Lab 6 sem ii_11_12
Lab 6 sem ii_11_12alish sha
 
Test 1 skema q&a
Test 1 skema q&aTest 1 skema q&a
Test 1 skema q&aalish sha
 
Test 1 skema q&a
Test 1 skema q&aTest 1 skema q&a
Test 1 skema q&aalish sha
 
Final project
Final projectFinal project
Final projectalish sha
 
Final project
Final projectFinal project
Final projectalish sha
 
Attn list test
Attn list testAttn list test
Attn list testalish sha
 
Carry markdam31303
Carry markdam31303Carry markdam31303
Carry markdam31303alish sha
 
Final project
Final projectFinal project
Final projectalish sha
 
Final project
Final projectFinal project
Final projectalish sha
 

More from alish sha (20)

T22016 – how to answer with ubs 9
T22016 – how to answer with ubs 9T22016 – how to answer with ubs 9
T22016 – how to answer with ubs 9
 
July 2014 theory exam (theory)
July 2014 theory exam (theory)July 2014 theory exam (theory)
July 2014 theory exam (theory)
 
Accounting basic equation
Accounting basic equation Accounting basic equation
Accounting basic equation
 
It 302 computerized accounting (week 2) - sharifah
It 302   computerized accounting (week 2) - sharifahIt 302   computerized accounting (week 2) - sharifah
It 302 computerized accounting (week 2) - sharifah
 
It 302 computerized accounting (week 1) - sharifah
It 302   computerized accounting (week 1) - sharifahIt 302   computerized accounting (week 1) - sharifah
It 302 computerized accounting (week 1) - sharifah
 
Lab 9 sem ii_12_13
Lab 9 sem ii_12_13Lab 9 sem ii_12_13
Lab 9 sem ii_12_13
 
Lab 10 sem ii_12_13
Lab 10 sem ii_12_13Lab 10 sem ii_12_13
Lab 10 sem ii_12_13
 
Lab 5 2012/2012
Lab 5 2012/2012Lab 5 2012/2012
Lab 5 2012/2012
 
Purpose elaborate
Purpose elaboratePurpose elaborate
Purpose elaborate
 
Lab sheet 1
Lab sheet 1Lab sheet 1
Lab sheet 1
 
Test 1 alish schema 1
Test 1 alish schema 1Test 1 alish schema 1
Test 1 alish schema 1
 
Lab 6 sem ii_11_12
Lab 6 sem ii_11_12Lab 6 sem ii_11_12
Lab 6 sem ii_11_12
 
Test 1 skema q&a
Test 1 skema q&aTest 1 skema q&a
Test 1 skema q&a
 
Test 1 skema q&a
Test 1 skema q&aTest 1 skema q&a
Test 1 skema q&a
 
Final project
Final projectFinal project
Final project
 
Final project
Final projectFinal project
Final project
 
Attn list test
Attn list testAttn list test
Attn list test
 
Carry markdam31303
Carry markdam31303Carry markdam31303
Carry markdam31303
 
Final project
Final projectFinal project
Final project
 
Final project
Final projectFinal project
Final project
 

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 />