Csc425 Lab 4
Csc425 Lab 4
Objectives:
Question 1:
0.0821 * P * V * W / T
Where
V is the volume of the gas in cm3,
W is the mass of the gas in gram
T is the temperature in Celsius
P is the pressure of the gas in atom
Write a program to calculate the Molar Mass (M) of a gas. The program should request all the
necessary data from the user. Make sure that you use the appropriate data types as learnt in
class. Save this source code file as Lab4Q1.cpp.
Question 2:
Given the following variables which have been assigned specific values as below:
i) A plus B minus C
ii) A divide by B times C modulus E
iii) D to the power of E
iv) Sum of squares of A and E
Make sure that you use the appropriate data types as learnt in class. Save this source code file
as Lab4Q2.cpp.
Question 3:
Write a program to ask the user to enter the radius of a circle. Then calculate the area of the
circle and the circumference using the formula:
Area of a circle = 3.142 * radius * radius
Both the value of area and circumference must be displayed to the user.
Make sure that you use the appropriate data types as learnt in class. The value for pi (3.142)
must be declared as constant. Save this source code file as Lab4Q3.cpp.
Question 4:
x is 35
x is 34
x is 34
x is 33
x is 34
x is 35
x is 36
x is 35
x is 30
Use the increment and decrement operator that you have learned in class. Save this source
code file as Lab4Q4.cpp.
Question 5:
Aqil is going to paint the front of the house for her mum and dad. Write a program to find the
area that needs to be painted. You must ask the user to input the width and length of the
windows, door and wall to determine the area that needs to be painted.
To submit your answers, in a new MS Word file, include:
i. A cover page that consists of your
a. name, matric number, group and title: LAB 4 TASK
ii. For every question,
a. Paste a screenshot of the source codes file
b. Paste a screenshot of the input/output screen
Example: