TST0255 Fundamental Programming Assignment 2 (Set A) PDF
Document Details
![ErrFreePiano](https://quizgecko.com/images/avatars/avatar-10.webp)
Uploaded by ErrFreePiano
USIM
2025
USIM
Tags
Summary
This USIM TST0255 Fundamental Programming assignment includes two programming questions. The first problem involves calculating the enthalpy change of a reaction using Hess's Law and thermochemical equations. The second task requires a program to calculate the recommended daily water intake based on body weight.
Full Transcript
A241_TST0255_Assignment 02_SetA TST0255/A241/ASGMT_02A SEMESTER 2, ACADEMIC SESSION 2024/2025 TST0255 – FUNDAMENTAL PROGRAMMING ❖ Part of 20% Practical Assignments. ❖ Please provide...
A241_TST0255_Assignment 02_SetA TST0255/A241/ASGMT_02A SEMESTER 2, ACADEMIC SESSION 2024/2025 TST0255 – FUNDAMENTAL PROGRAMMING ❖ Part of 20% Practical Assignments. ❖ Please provide your written code and a screenshot for each input. ❖ Submit the assignment (ONLY PDF format) through GOALS. ❖ For all problems below, use C++ programming language. ❖ Question 1 : Hess's Law states that the total enthalpy change for a reaction is the same regardless of whether the reaction occurs in one step or multiple steps. This law allows us to calculate the enthalpy change for complex reactions by summing the enthalpy changes of individual steps. Given Hess’s Law formula are given as: 0 0 ΔHreaction = ∑Δ𝐻𝑓 (products) − ∑Δ𝐻𝑓 (reactants) By using Hess’s Law and thermochemical equation for the all formations of each substance in Table 1, calculate the enthalpy change (ΔHreaction) for the X reaction. TABLE 1 Thermochemical Equation for Formation and X reaction 1- Thermochemical Equations for Formation (Combustion of Methane) Methane (CH₄) : C + 2H2 → CH₄ ΔH = −74.8 kJ/mol Carbon dioxide (CO₂) : C + O2 → CO2 ΔH = −393.5 kJ/mol Water (H2O) : H2 + ½O2 → H2O ΔH = −241.8 kJ/mol X reaction : CH4 + 2O2 → CO2 + 2H2O ΔHreaction = ? kJ/mol HAKCIPTA TERPELIHARA USIM A241_TST0255_Assignment 02_SetA TST0255/A241/ASGMT_02A 2- Thermochemical Equations for Formation (Oxidation of Carbon Monoxide) Carbon monoxide (CO) : C + ½O2 → CO ΔH = −110.5 kJ/mol Carbon dioxide (CO₂) : C + O2 → CO2 ΔH = −393.5 kJ/mol Oxygen (O2) : O2 → O2 ΔH = 0 kJ/mol X reaction : 2CO + O2 → 2CO2 ΔHreaction = ? kJ/mol Your code must use suitable data type, variables, proper arithmetic, has a few lines of comments to describe your code and do not contain user defined functions. The program terminal should be able to receive standard enthalpy value (refer TABLE 1) as input and calculate reaction X enthalpy change value. Finally, show the value as an output with proper units exactly like shown in FIGURE 1. FIGURE 1 Output Program HAKCIPTA TERPELIHARA USIM A241_TST0255_Assignment 02_SetA TST0255/A241/ASGMT_02A ❖ Question 2 : Write a program to calculate the recommended daily water intake for adults based on their body weight. First, create a conversion program that converts any given amount of kilograms (kg) into pounds (lbs), as one kilogram equals 2.20462 pounds. Then, calculate the recommended water intake (in mL and L) based on the guideline that adults should consume 15.88 mL of water per pound of body mass daily. Daily Water Intake in mL = Weight in lbs × 15.88 Your code must use suitable data type, variables, proper arithmetic, has a few lines of comments to describe your code, have constants, global and local variables and do not contain user defined functions. Your program terminal should be able to receive weight in kg (refer TABLE 2) as inputs and calculate the daily water intake in mL and L value. Finally, show the value in two decimal points as an output with proper units exactly like shown in FIGURE 2 and fill in the blank data in TABLE 2. FIGURE 2 Output example TABLE 2 Weight input Weight input (kg) Daily water intake (generated) 54.0 1890.51 mL (1.89 L) 98.5 3448.42 mL (3.45 L) 60.4 2114.57 mL (2.11 L) 83.8 2933.78 mL (2.93 L) HAKCIPTA TERPELIHARA USIM