Вы находитесь на странице: 1из 3

Dasar Komputer dan Pemrograman

Semester I 2017-2018
Dosen: Petrus Santoso

LAB. SESSION 04
Objectives:

• Student have understanding about input, output and control structure and
function

• Student have a chance to try some code examples. Student can type, compile,
execute the given code examples and analyze the results.

Description:

Topic:

Input, Output, Control Structure, Function

Scope:

• Answer some questions to show knowledge comprehension

• Type, compile, execute, analyze some code examples

• The result must be submitted through http://lentera.petra.ac.id

Result Description:

Please write your answer, the screen shot of program’s result using a word processing
program like Microsoft Word. Combine your answer with all your program code
(CodeBlocks project) in a single .zip file. Name your file as Lab04_NRP_FirstName. NRP
and FirstName should be replaced according to student identity.

Jurusan Teknik Elektro Universitas Kristen Petra


Visi: Menjadi Jurusan Teknik Elektro yang bereputasi internasional, bermitra dengan
industri dan masyarakat, berkomitmen pada nilai-nilai Kristiani
Dasar Komputer dan Pemrograman
Semester I 2017-2018
Dosen: Petrus Santoso

Grading Criteria:

A
Finish more than 85% of the problems correctly

B
At least finish 75% of the problems correctly

C
At least finish 50% of the problems correctly

D/E
Work on less than 50% of the problems

1. What is the definition of function? Give the advantages of using function! Explain the
procedure of writing a function!

2. What is function prototype? Give explanation about the following function prototype!

a. int fun (char b);

b. void fn (int a, float b, unsigned c);

c. char fn (void);

d. double fn (double a, int b);

e. void nopar (void);

3. What is an argument? What is the purpose of an argument?

4. Write the first line of function definition, including the argument declaration for the
following constraints:

a. A function named “contoh” give a result and return an integer value.


b. A function named “akar” receive 2 integer arguments and return a
floating-point value.
c. A function named “pindah” receive an integer argument and return a
character value.

5. Implement a function to convert a number into Roman Numeral presentation! Name


the function as “ConvertRoman”. The function should accept Integer input and
print the conversion result (no returned value)! Write a program to test the
functionality of the function!

Jurusan Teknik Elektro Universitas Kristen Petra


Visi: Menjadi Jurusan Teknik Elektro yang bereputasi internasional, bermitra dengan
industri dan masyarakat, berkomitmen pada nilai-nilai Kristiani
Dasar Komputer dan Pemrograman
Semester I 2017-2018
Dosen: Petrus Santoso
6. A toy factory produces Mickey Mouse and Minnie Mouse dolls.

A Mickey Mouse doll has the following components: head, body, 2 hands and 2 feet. A
Minnie Mouse doll has the following components: hair ribbon, head, body, 2 hands,
and 2 feet.

The production time of each components are as follow: head and body need 3 minutes
each, hair ribbon need 1,5 minutes, hand and foot need 1,25 minutes each.

Create a structured program (with function) to calculate the amount of time needed
to produce order from customers! Input of the program: the number of order
(Mickey Mouse and Minnie Mouse dolls). Output of the program: Needed time to
finish the order. (Note: Display the needed time in the form of day, hour and minute).

Jurusan Teknik Elektro Universitas Kristen Petra


Visi: Menjadi Jurusan Teknik Elektro yang bereputasi internasional, bermitra dengan
industri dan masyarakat, berkomitmen pada nilai-nilai Kristiani

Вам также может понравиться