SCP1103 Programming Technique C SEMESTER I 2007/2008: Universiti Teknologi Malaysia
SCP1103 Programming Technique C SEMESTER I 2007/2008: Universiti Teknologi Malaysia
SCP1103
PROGRAMMING TECHNIQUE C
SEMESTER I 2007/2008
ASSIGNMENT 1
FLOWCHARTING
Student’s Name:
NGO CHEE WUNG
IC NO
881116-08-5265
DATE OF SUBMISSION
12 AUGUST 2007
2
Part A: Flowcharts
Draw your flowcharts using Microsoft ® Visio ™ and then “copy-and-paste” them
into this part. Describe each flowchart about its purpose, input and output and the
processes involved. Below are two examples.
START
PRICE = Car_Price ( )
YEARS = Loan_Duration_In_Year ( )
INTEREST = Total_Interest
( PRINCIPAL LOAN, RATE, YEARS )
3
2
Print
PRINCIPAL LOAN
YEARS
RATE
INTERESTS
TOTAL LOAN
SCHEDULE = Payment_Schedule
( YEARS, TOTAL LOAN )
Yes
START OVER
1
Repeat The
Process ?
Y
e
END
4
Flowchart : Function Definition of “PRICE = Car_Price ( ) ”
Name
Purpose : To enter the car price
Input : a ,car price
Output : acceptable car price
Car_Price ( )
If
10,000< a < 50,000
Yes
Return a
5
Flowchart : Function Definition of “ DISCOUNT = Discount ( PRICE )”
Name
Purpose : To Check for the discount
Input : a ,car price
Output : s: Car price after discount
Discount ( a )
Read
a
Initialize
p = 1000
If a ≥ 25,000
No
Yes
s=a–p s=a
s: car price after discount
a: car price
Return s
6
Flowchart : Function Definition of “INSTALLMENT = Car_Installment
Name ( PRICE ) ”
Purpose : To Check the installment
Input : c, installment
Output : acceptable installment
Car_Installment ( s )
Read
c: car installment
No
c s:car price
If
c ≥ o.1 s
Yes
Return c
7
Flowchart Name : Function Definition of “PRINCIPAL LOAN =
Principal_Amount _Of_ Loan
( PRICE, INSTALLMENT )
”
Purpose : To calculate the principal amount of loan
Input : s: car price after discount & c: installment
Output : d:Principal amount Of Loan
Principal_ Amount_Of_loan
( s,c )
Read
s,c
Return d
8
Flowchart : Function Definition of “YEARS = Loan_Duration_In_Year ( )”
Name
Purpose : To check the loan duration in years
Input : e : loan duration (years)
Output : acceptable loan duration
Loan_Duration_In_Year ( )
Interest_Rate_Per_Year ( e )
No Read
e : loan duration in year
e
If
2≤e≤7
Yes
Return e
9
Flowchart Name : Function Definition of “RATE =
Interest_Rate_Per_Year ( YEARS )”
No
No No
2≤e≤4 5≤e≤6 e=7
Return r
Interest Rate (per year)
H = ( Counter / e ) * d * r
h =H+h
10
Flowchart : Function Definition of
Name
“INTEREST = Total_Interest ( PRINCIPAL LOAN, RATE, YEARS )”
rate
Purpose : To calculate the total interest
Input : r: interest rate , d: amount of loan , e: year of loan
Output : h: Total interest
Total_Interest ( r, d ,e )
Read
r ,d , e
H: Interest rate at
particular year
No
If
Counter = Counter -1
Counter = 0
Yes
Return h
11
Flowchart : Function Definition of
Name “TOTAL LOAN = Total_Amount_Of_Loan
( PRINCIPAL LOAN, INTEREST )”
Total_Amount_Of_Loa
n ( d, h )
i =d + h
Return i
12
Payment Schedule ( i , e )
k : average payment
k = i / ( 12 * e ) i : total amount of loan
e: loan duration in years
Read
i,k
Initialize
Month = 1
Payment = k
Balance = i – k
Print Month
Print Payment
Print Balance
No
If Month = Month + 1
Balance = 0 Payment =k
Balance = i – ( Month * k )
Yes
Part B: Reflections
You are expected to have completed Part A before going on to this part. The
purpose of this part is to determine whether you have achieved the objectives of
this assignment. Answer the following questions. The score for each question is
as indicated. If you prefer to answer in Bahasa Malaysia, you may do so.
Question 1
Do you think having many functions in an algorithm is a good idea? Explain why. [3
marks]
13
Answer:
I agree it is a good idea. This is because it becomes easier more easy to find
solution when we consider it as pieces of small problems. Hence, it is easier to
design the algorithm. Besides, it makes the flowchart look nicely and
systematically. The system can run smoothly and not complicated.
Question 2
Explain how you applied “Thinking in modular ways” in this assignment. [3 marks]
Answer:
Thinking in modular way enable me design the flowchart creatively I consider each
requirement as module. First, I understand the problem as whole. Than, break into
simpler and understandable parts. After that, I sketch various of method to solve
the problem and choose the most suitable. Furthermore, I use actual parameter
main flowchart and forma parameter in function definition. By looking these
variables, one is able to combine the main function with its definition. As a result,
he or she can undertand the main function as well.
Question 3
As stated in the course planning, you are expected to have a mini project later.
You will do the project in a group of 3 persons.
The tasks are supposed to be distributed to the team members. However, you
may think it is more difficult to do the project separately, since it is a single
program. Hence, you decide to do it together.
On the other hand, you may think your job is easier if the tasks are distributed
equally to all the team members. However, when it comes to the integration,
sometimes you will get troubled. What your members have done cannot be
combined with yours or vice versa.
Explain how you will apply “Thinking in modular ways” in an appropriate manner
for your future group assignment in order to overcome those kinds of problem. [4
marks]
Answer:
First of all, we will choose the group leader among us. Than we start plan the
schedule and task due to the assignment together. Task are devided equally
among us to avoid argument. Since we are work in a group, each member will do
some part f the assignment. Besides, we will collect the contact number each of
our members. Its important as we can discuss through the phone if we face with
urgent problems. Apart from that, we can found the variety of resources from
library as our references. We also can consult with lecturer if we not clear of the
requirements of the assignment. Group discussion are done frequently as to speak
out the problems that occurred. Hence, we can find the varies of solution among
group member. Group leader has to make sure that everyone do their work
according to the schedule. Each of the group member should respect to others and
makes contributes to it .Teamwork is the only key to gain success in our works.
14
Part C: Log Book
As you work with your assignment, record the activities you have done. At a
minimum, you are expected to write when you have started the assignment, what
activities have involved and when you have submitted the assignment. Fill in the
following table. You are also expected to write the names of your friends or
persons who you have had discussions with;. Fill in the “Discussion with” column.
15
Part D: Estimated Scores
You are expected to have completed Part A – C before going on to this part. In this
part, you will assess your own assignment. However, the score from the
assessment will not be taken. The idea behind this self assessment is to promote
you to full fill the requirements of the assignment as good as possible in order to
get a better grade.
Guides to assessment:
Scale Column:
How good is your answer for each of the following criterion? Please rate yourself
according to these scales:
9- 10 : Excellent
7–8 : Good
5–6 : Average
1–4 : Bad
Score Column:
Fill in the column using this formula:
Score = Max_Score x Scale x 0.1
Total:
Calculate the summation of all scores from the Score Column.
Example:
Main Flowchart: Scale= 8 Score=5 x 8 x 0.1 = 4
Max Scal
Criterion Scor e Scor
e (1- e
10)
Report:
Part A: Flowcharts
Main Flowchart 5 10 5
Requirement 1: car price 5 10 5
Requirement 2: discount 5 10 5
Requirement 3: installment 5 10 5
Requirement 4: loan amount 5 10 5
Requirement 5: the number of 5 10 5
years
Requirement 6: interest rate 10 9 9
Requirement 7 : total interest and 5 10 5
total loan
Requirement 8: loan information 5 10 5
Requirement 9: payments schedule 20 9 18
Requirement 10: start over 5 10 5
Part B: Reflections 10 8 8
Part C: Log Book 5 10 5
Part D: Estimated Scores 5 8 4
Post-Mortem Survey* 5 10 5
Total 94
*You are entitled to get a full score for Post-Mortem Survey as long
you fill in all the questions
16