Geronimo Le3
Geronimo Le3
This is a comment line. All lines beginning with two slash signs (//) are considered
comments and do not have any effect on the behavior of the program.
#include <iostream>
Lines beginning with a hash sign (#) are directives for the preprocessor. This specific
file (iostream) includes the declarations of the basic standard input-output library in
C++.
3.5 Materials/Equipment
Computer Unit
4.6 Procedure/s
1. Write a program that will display your weekly class schedule in a listed view.
Consider the following output:
Program code
#include<iostream>
using namespace std;
int main()
{
int Schedule;
cout << "Weekly Schedule of ME21";
cout << "\nDay\t\t\tSubject\t\t\t\t\t\tTime\t\t\t\tRoom";
cout << "\nMonday (Face to Face)\n";
cout << "\n\t\t\tEngineering Drawing\t\t\t\t7:00am - 9:00am\t\t\t(408)\n";
cout << "\n\t\t\tDifferential Equation\t\t\t\t11:00am - 12:50pm\t\t(312)\n";
cout << "\n\t\t\tStatics of Rigid Bodies\t\t\t\t1:00pm - 2:50pm\t\t\t(514)\n";
cout << "\n\t\t\tReadings In Philippine History\t\t\t5:00pm - 6:50pm\t\t\t(311)\n";
cout << "\nTuesday (Online Class)\n";
cout << "\t\t\tGE Elective:Bio Engineering Engineering\t\t1:00pm -
2:50pm\t\t\t(Online Class)\n";
cout << "\t\t\tLife Works of Rizal\t\t\t\t3:00pm - 4:50pm\t\t\t(Online Class)\n";
cout << "\nWednesday (Face to Face)\n";
cout << "\t\t\tWorkshop and Theory and Practice\t\t9:00am - 11:50am\t\t(LG201)\n";
cout << "\t\t\tComputer Fundamentals and Programming\t\t4:00pm -
6:50pm\t\t\t(404)\n";
cout << "\nThursday (Face to Face)\n";
cout << "\t\t\tDifferential Equation\t\t\t\t11:00am - 12:50pm\t\t(312)\n";
cout << "\n\t\t\tStatics of Rigid Bodies\t\t\t\t1:00pm - 2:50pm\t\t\t(514)\n";
cout << "\n\t\t\tReadings In Philippine History\t\t\t5:00pm - 6:50pm\t\t\t(311)\n";
cout << "\nFriday (Online Class)\n";
cout << "\t\t\tOrientation to Mechanical Engineering\t\t11:00am - 12:50pm\t\t(Online
Class)\n";
cout << "\t\t\tGE Elective:Bio Engineering Engineering\t\t1:00pm -
2:50pm\t\t\t(Online Class)\n";
cout << "\t\t\tLife Works of Rizal\t\t\t\t3:00pm - 4:50pm\t\t\t(Online Class)\n";
return 0;
}
4. Given the table below, declare the following variables with the corresponding data
types and initialization values. Output the variable names together with the values.
6. Given the following expressions, re-write and add parentheses based on the sequence
of how they will be evaluated.
a/b^c^d–e+f–g*h+i
3 * 10 *2 / 15 – 2 + 4 ^ 2 ^ 2
r ^ s * t / u – v + w ^ x – y++
8. The user will input a Philippine amount, then the said amount will be converted to
different currencies namely: US Dollar, Euro, Yuan, Koruna, Krone, Sheqel and Dinar
Sample run:
US Dollar is : 1.000
Euro : 0.734719
Yuan : 6.346934
Koruna : 18.77263
Krone : 5.449007
Sheqel : 3.726334
Dinar : 0.274588
Program code
#include <iostream>
using namespace std;
int main() {
// Declare variables
float phpAmount;
// Exchange rates (sample values, you can update these based on currentrates)
US Dollar is : 1.000
Euro : 0.734719
* Arithmetic Operators
* Logical Operators
* Relational Operators
Program code
#include <iostream>
using namespace std;
int main() {
// Declare variables
int a = 10, b = 5, c = 20;
bool result;
// 1. Arithmetic Operators
cout << "Arithmetic Operators:" << endl;
cout << "a + b = " << a + b << endl; //
Addition
cout << "a - b = " << a - b << endl; //
Subtraction
cout << "a * b = " << a * b << endl; //
Multiplication
cout << "a / b = " << a / b << endl; //
Division
cout << "a % b = " << a % b << endl; //
Modulus (remainder)
// 2. Relational Operators
cout << "\nRelational Operators:" << endl;
cout << "a == b: " << (a == b) << endl; //
Equal to
cout << "a != b: " << (a != b) << endl; //
Not equal to
cout << "a > b : " << (a > b) << endl; //
Greater than
cout << "a < c : " << (a < c) << endl; //
Less than
cout << "a >= b: " << (a >= b) << endl; //
Greater than or equal to
Note: The following rubrics/metrics will be used to grade students’ output in the Lab
Criteria Descriptions Points
Task N.o 1 The variables and the corresponding values are properly 50
assigned and used in the program.
Output The output of the program is correct and solved based on the 50
problem stated.
Total 100%
Summative 4.