dam31303 lab sheet 4

3
UNIVERSITI TUN HUSSEIN ONN MALAYSIA FACULTY OF MECHANICAL AND MANUFACTURING ENGINEERING DTI2143/DAM31303: COMPUTER PROGRAMMING 1. Write a program to calculate circumference and area of a circle (Note: PI=3.142 , circumference =2*PI*rad , and area= PI*rad 2 ) The program should similar to: 2. Write a program to calculate average velocity, v of a particle on a line travelling between point p1 and p2 form time 1 to time 2 (Note : v= p 2p 1 t 2t 1 ) , The program should similar to: LAB EXERCISE 4 Regular expression and operators

Upload: alish-al-shahab

Post on 25-May-2015

273 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Dam31303 lab sheet 4

UNIVERSITI TUN HUSSEIN ONN MALAYSIAFACULTY OF MECHANICAL AND MANUFACTURING ENGINEERING DTI2143/DAM31303: COMPUTER PROGRAMMING

1. Write a program to calculate circumference and area of a circle (Note: PI=3.142 , circumference =2*PI*rad, and area= PI*rad2 )The program should similar to:

2. Write a program to calculate average velocity, v of a particle on a line travelling between point p1 and p2 form time 1 to time 2

(Note : v=p2−p1t 2−t 1 ) , The program should similar to:

LAB EXERCISE 4 Regular expression and operators

Page 2: Dam31303 lab sheet 4

3. Write a program to calculate the amount of heat required to raise the mercury

temperature. (Note: Specific heat capacity, c : Qm∆θ

, therefore the quantity heat

lost is Q=mc ∆θ; Q for mercury=139 J kg-1 ℃-1 )To solve: the bulb of thermometer contains 3.4g of mercury. What amount of heat is required to raise the temperature of the mercury from 30℃ to 100℃The program should similar to:

4. Write a program to calculate: The total amount a customer has to pay for items that he/she bought in a bookstore. The user will prompt the amount of each item bought and the total amount to be paid will be displayed. Price list:

Item PriceRed pen RM 1.20Pencil RM 0.80marker RM 3.40ruler RM 0.50

Page 3: Dam31303 lab sheet 4