You are on page 1of 12

Module: Fundamentals of programming

Submitted by:

ID:

Submitted to

Department of Computer science Middle East College Oman


Contents
Task 1.........................................................................................................................................................2
Abstract......................................................................................................................................................2
Introduction:..............................................................................................................................................3
Introduction of Task 1...........................................................................................................................3
Proposed solution...............................................................................................................................3
Timeline..................................................................................................................................................4
References:.................................................................................................................................................4
Task 1

Determination of data types:

As we have given different management system that has to be analyzed by


using MEC e-library so I am considering hotel booking system as a main module which is being
observed to determined the variables and their data types.

Variables used in Hotel booking system:

There are following minimum 5 variables which are considered


as attributes of this system.

 No of available Rooms ( integer data type, double , long )


 No of beds Integer double , long
 Meal Type String ,char
 Room service Boolean (yes or No)
 Rent Price double , float , long int

Reason for choosing Data type:

As we have chosen 5 different data variables for our system. So, we will
explain each data types step by step.

1. For no of room we can select the data type as integer because room no is type of whole
no. it may be 100, 200 etc.
2. For no of beds there may be fixed beds in any room but may not be in decimal or
fraction that’s why we chose as a double data type
3. In case of meal type there may be different variant for example vegetarian, non-
vegetarian, cutting bulking etc. so, we have chosen string or char data type.
4. For a room service a person may be interested or not because of his privacy that’s why
we choose Boolean.
5. Rent price can vary in range of decimal that is reason we have chose double or float.
Task 2:
As my id is 19F19778

A=1, b=9 , c=1, d=9 ,e=7,f=7

So

1.

d*10/2^a-(6*b%f)

now putting the values, we get

9*10/2^(6*9%7)

= 9*5^(6*2)

= 45^12

=40

2.
Not(a<b)AND(20%d<=0)OR(e>f)

now putting the values, we get

NOT(1<9)AND(20%9<=0)OR(7>7)
NOT(False) AND(2<=0)OR False
=True AND False OR False
= True AND False
= False

Task 3:
a)

In this part we will first write pseudocode than flowchart

Pseudocode

1. Declare varables name S1 S2 and S3 for marks of students


2. Print the statement for entrying the number
3. Read S1 , S2, S3
Flowchart

b)

Pseudocode

1. Declare varables name S1 S2 and S3 , S4 as float for marks of students


2. Print the statement for entrying the number
3. Read S1 , S2, S3
4. Print enter the marks of 4th student
5. Read s4 marks
Flowchart
c)

Pseudocode

1. Step1: Declare s1_mark1, s1_mark2, s1_mark3, s2_mark1, s2_mark2, s2_mark3,


s2_mark4,s1_avg,s2_avg and tot_avg as float.

2. Step 2: Print "Enter the marks of 3 students from session A acheived in the module
Fundamentals of Programming:"
3. Step 3: Read s1_mark1, s1_mark2 and s1_mark3.

4. Step 4: Print "Enter the marks of 4 students from session B acheived in the module
Fundamentals of Programming:"
5. Step 5: Read s2_mark1, s2_mark2, s2_mark3 and s2_mark4

6. Step 6: Compute s1_avg=(s1_mark1+s1_mark2+s1_mark3)/3;


7. Step 7: Compute s2_avg=(s2_mark1+s2_mark2+s2_mark3+s2_mark4)/4;

8. Step 8: Compute
tot_avg=(s1_mark1+s1_mark2+s1_mark3+s2_mark1+s2_mark2+s2_mark3+s2_mark4)/7;
9. 4. Display the Average of Session A, Session B and Overall:
Flowchart
d)

Pseudocode:

Step1: Declare s1_mark1, s1_mark2, s1_mark3, s2_mark1, s2_mark2, s2_mark3,


s2_mark4,s1_avg,s2_avg and tot_avg as float.

Step 2: Print "Enter the marks of 3 students from session A acheived in the module
Fundamentals of Programming:"

Step 3: Read s1_mark1, s1_mark2 and s1_mark3.

Step 4: Print "Enter the marks of 4 students from session B acheived in the module
Fundamentals of Programming:"

Step 5: Read s2_mark1, s2_mark2, s2_mark3 and s2_mark4.

Step 6: Compute s1_avg=(s1_mark1+s1_mark2+s1_mark3)/3;

Step 7: Compute s2_avg=(s2_mark1+s2_mark2+s2_mark3+s2_mark4)/4;

Step 8: Compute
tot_avg=(s1_mark1+s1_mark2+s1_mark3+s2_mark1+s2_mark2+s2_mark3+s2_mark4)/7;

Step 9: Print "Average marks of Session A is s1_avg".

Step 10: Print "Average marks of Session B is s2_avg".

Step 11: Print "Overall average marks in both sessions is tot_avg".


Flow Chart:
Sample program in C++:

#include <iostream>

using namespace std;

int main()

float s1_mark1, s1_mark2, s1_mark3, s2_mark1, s2_mark2, s2_mark3, s2_mark4,s1_avg,


s2_avg,tot_avg;

cout<<"Enter the marks of 3 students from session A acheived in the module Fundamentals of
Programming:";

cin>>s1_mark1>>s1_mark2>>s1_mark3;

cout<<"\nEnter the marks of 4 students from session B acheived in the module Fundamentals of
Programming:";

cin>>s2_mark1>>s2_mark2>>s2_mark3>>s2_mark4;

s1_avg=(s1_mark1+s1_mark2+s1_mark3)/3;

s2_avg=(s2_mark1+s2_mark2+s2_mark3+s2_mark4)/4;

tot_avg=(s1_mark1+s1_mark2+s1_mark3+s2_mark1+s2_mark2+s2_mark3+s2_mark4)/7;

cout<<"\nAverage marks of Session A is "<< s1_avg;

cout<<"\nAverage marks of Session B is "<< s2_avg;

cout<<"\nOverall average marks in both sessions is "<< tot_avg;

return 0;

}
References:
1. OCW MIT, Signals and system ,viewed 20 OCT 2021,
<https://ocw.mit.edu/resources/res-6-007-c programming -spring-2011/ /. >
2. McTavish, C., & Sankaranarayanan, S. (2010, May). Intelligent agent based hotel search
& booking system. In 2010 IEEE International Conference on Electro/Information
Technology (pp. 1-6). IEEE.
3. Strachey, C. (2000). Fundamental concepts in programming languages. Higher-order
and symbolic computation, 13(1), 11-49.
4. Ros, J., Arrondo, L., Gil, J., & Iriarte, X. (2007). LIB3D MEC–GINAC, A LIBRARY FOR
SYMBOLIC MULTIBODY DYNAMICS. ECCOMAS Multibody Dynamics, Milano.

You might also like