You are on page 1of 11

FACULTY OF ENGINEERING AND COMPUTING

PROGRAMME : Bachelor of Electronic Engineering with Honours /


Bachelor of Mechanical Engineering with Honours

ACADEMIC YEAR : 2022

MODULE : Programming for Engineers

MODULE CODE : BEE2009

MODULE LEADER : Mohammad Hafizuddin bin Ameruddin

ASSIGNMENT TYPE : Lab Worksheet 2

INTAKE/GROUP :

DISTRIBUTION DATE : Thursday, 29 September 202

SUBMISSION DATE : Thursday, 6 October 2022

STUDENT NAME STUDENT ID CLASS CODE

BENGME2A
Fow Seng Joe B1757
Lab Feedback Form

Programming for Engineers


Mark allocation chart
1 2 3 4 5
Very poor Unsatisfactory Satisfactory Good Excellent

Assessment Criteria Mark


1. Theoretical Understanding /5
2. Design Methodology /5
3. Use of Tools /5
4. Data Record / Data Collection /5
5. Results and Discussion /5
6. Determination on Achieving Goals /5
7. Lab Work Evaluation /5
8. Report Writing /5

Total Marks / 40

General Comments:

Assessor’s Signature: Date:

Name:
Learning Outcomes

Learning Outcomes Task No.

1. Describe terms associated with structured


programming.

2. Design a structured solution using the input-


process-output (IPO) chart for a given
engineering problem.
Assessed in all lab tasks
3. Develop a programming solution for a given
engineering problem.

4. Produce a written documentation for use in


program maintenance and end-user reference.
Lab 1 – Intro to C++ Programming IDE

Objective

• To implement the C++ high-level language using Code Blocks: IDE.


• To evaluate the basic input, processing, and output structure that can be
used to create multiple programs.

Introduction

This laboratory introduces the field of computer science and covers the
fundamentals of hardware, software, operating systems, programming, problem
solving, and software engineering. The components of programs, such as key
words, variables, operators, and punctuation are covered.

Instruction and Task

Read and answer the Lab 1 Intro to C++ Programming IDE that has been
uploaded in Laboratory folder in Microsoft Teams.

Answer
Lab: 1 Introduction to C++ Programming and IDE BEE2009 PFE

5
Laboratory 2: Working with Tokens & IO Statements
Tutorial Activities
1.
Syntax errors • A syntax error is an error in the syntax of a sequence of
characters or tokens that is intended to be written in a
particular programming language. For example, a
missing semicolon at the end of a line or an extra
bracket at the end of a function may produce a syntax
error.
Runtime errors • A runtime error is a program error that occurs while the
program is running. For instance, there will be
misspelled or incorrectly capitalized variable and
function names. Attempts to perform operations such as
math operations on data of the wrong type.
Logic errors • The logical errors occur due to a fault in the logic of the
program. For instance, a logic error is a 'bug' or mistake
in a program's source code that results in incorrect or
unexpected behaviour.

2. (a) Syntax error.


(b) Runtime error
(c) Runtime error

3.
No. Rules Examples
1 Cannot have white space on the identifier resistance value

2 Cannot have hyphen ‘-’ on the identifier abc-xyz

3 Cannot start with digit resistance value

4 Cannot have symbol ‘%’ on the identifier five%tolerance

5 Cannot use keyword as identifier float


4.

5.
Input Code:

Output code:

6.
a. 103e-4 0.0103
b. 123.45e3 123450
c. 1.2345e6 1234500

7.
a. 1300 1.3 X 103
b.123.45 1.2345 X102
c. 00426 4.26 X 10-3
8.
a. Valid d. Valid
b. Valid e. Invalid
c. Valid f. Valid

9.
Input code

Output code

10. Input code


Output code

Programming Activities:
1) Input code

Output code
2) Input Code

Output code

3) Input code
Output Code

4) Input Code

Output code

You might also like