Completed Assignment Airlines
Completed Assignment Airlines
Programming Technique
Section 03B
Assignment 1
2
Introduction
Students in University Malaysia Pahang who are taking Programming Technique
subject this semester are needed to complete an assignment in coding about Airlines online
booking flight. Each student were given a different type of Airline all around the world.
Students need to identify how the Airline of online system works such like its price,
December 1952,64 years ago and its slogan is 'INSPIRATION OF JAPAN'. It has a fleet
size of 219 and 89 destinations available. ANA contain 3 type of flight, which are One-
way, Return and both. But I am required to just do a simple One-Way system for a test
before proceeding. I am also given looping type FOR and DO WHILE for my coding. An
This system will asked user to input all the information below :
From={Tokyo}
c) NUMBER OF PASSENGER
d) CLASS CHOSEN
e) DISCOUNT CODE
3
ANA is the largest airline in JAPAN. In my system, the customer need to input
their personal detail such as full name, age, classfare and their discount code if they have
it. This system already given 6 choices of destination that they have to choose. They only
can depart from Tokyo and choose the destination from that 6 choices. The user can choose
more than one country by entering the number of destination that they want (not more than
6).
This system provided 4 type of class which are Economy Premium Economy,
Business and First. The price for Economy class are more affordable to the user compared
to Premium Economy while Business class is higher price and First has the highest price.
This flight can be board by different ages of passengers from infants until adults. There is
no limited number of passengers that can board in this flight. Each age have different price.
The discount will be given 30% off for the customer that has the code word. All the price
4
CODING
5
#include <stdio.h>
int main()
int destination;
int i;
int totalprice=0;
char name[30];
int age[20];
char classfare[20];
int overallprice=0;
int passenger;
char discount[30];
int price;
int j;
//This program ask user to input the number of destinations they are going.
scanf("%d" , &destination);
int to[destination];
char discount[destination][30];
6
printf("\nDESTINATION %d : " , i+1 );
scanf("%d" , &to[i]);
scanf("%d" , &passenger);
char name[passenger][30];
int j=0;
do
fflush (stdin);
gets(name[j]);
scanf("%d" , &age[j]);
fflush (stdin);
scanf("%c" , &classfare[j]);
if(to[i]==1)
if (classfare[j]== 'E')
if (age[j]>15)
7
{
price=14398.00;
price=14398.00;
price=10848.00;
else
price=1409.00;
if (age[j]>15)
price=15080.00;
price=15080.00;
price=11361.00;
else
8
{
price=1477.00;
else
if (age[j]>15)
price=21174.00;
price=21174.00;
price=15932.00;
else
price=2086.00;
else if(to[i]==2)
if (classfare[j]== 'E')
9
if (age[j]>15)
price=11857.00;
price=11857.00;
price=8899.00;
else
price=1168.00;
if (age[j]>15)
price=12799.00;
price=12799.00;
price=9592.00;
10
else
price=1260.00;
if (age[j]>15)
price=14505.00;
price=14505.00;
price=10894.00;
else
price=1433.00;
else
if (age[j]>15)
price=23285.00;
11
{
price=23285.00;
price=23243.00;
else
price=2311.00;
else if(to[i]==3)
if (classfare[j]== 'E')
if (age[j]>15)
price=11057.00;
price=11057.00;
12
price=8308.00;
else
price=1088.00;
if (age[j]>15)
price=12799.00;
price=12799.00;
price=9612.00;
else
price=1260.00;
else
if (age[j]>15)
price=14505.00;
13
}
price=14505.00;
price=10894.00;
else
price=1433.00;
else if(to[i]==4)
if (classfare[j]== 'E')
if (age[j]>15)
price=6444.00;
price=6444.00;
14
{
price=4829.00;
else
price=631.00;
else
if (age[j]>15)
price=10093.00;
price=10093.00;
price=7568.00;
else
price=996.00;
else if(to[i]==5)
15
{
if (classfare[j]== 'E')
if (age[j]>15)
price=12378.00;
price=12378.00;
price=9300.00;
else
price=1216.00;
if (age[j]>15)
price=13180.00;
price=13180.00;
16
}
price=9901.00;
else
price=1296.00;
else
if (age[j]>15)
price=16347.00;
price=16347.00;
price=12279.00;
else
price=1613.00;
17
else
if (classfare[j]== 'E')
if (age[j]>15)
price=9338.00;
price=9338.00;
price=7013.00;
else
price=923.00;
if (age[j]>15)
price=10300.00;
18
price=10300.00;
price=7735.00;
else
price=1019.00;
else
if (age[j]>15)
price=12545.00;
price=12545.00;
price=9419.00;
else
price=1243.00;
19
totalprice=totalprice+price;
j++;
while(j<passenger);
fflush (stdin);
gets(discount[i]);
if (discount=='A')
totalprice=totalprice - (totalprice*0.3);
else
totalprice=totalprice;
overallprice=overallprice+totalprice;
printf("\n***********************************************************************
*****************************\n");
if (to[i]==1)
printf("\nDestination : Delhi");
20
else if (to[i]==2)
printf("\nDestination : Singapore");
else if (to[i]==3)
else if (to[i]==4)
printf("\nDestination : Manila");
else if (to[i]==5)
printf("\nDestination : Jakarta");
else
printf("\nDestination : Bangkok");
for(j=0;j<passenger;j++)
21
printf("\n\nCLASS : %c" , classfare[j]);
printf("\n***********************************************************************
*****************************\n");
printf("\n***********************************************************************
*****************************\n");
printf("\n***********************************************************************
*****************************\n");
return 0;
22
OUTPUTS
23
Destination:2
To : 1 (Delhi) Passenger : 3
To : 2 (Singapore) Passenger : 4
24
Destination : 1
To : 6 (Bangkok)
Passenger : 1
25
26
27
28
29
EVIDENCE
30
DELHI (ECONOMY)
31
32
DELHI (PREMIUM)
33
34
DELHI (BUSINESS)
35
36
SINGAPORE (ECONOMY)
37
38
SINGAPORE (PREMIUM ECONOMY)
39
40
SINGAPORE (BUSINESS)
41
42
SINGAPORE (FIRST)
43
44
KL (ECONOMY)
45
46
KL (PREMIUM ECONOMY)
47
48
KL (BUSINESS)
49
50
MANILA (ECONOMY)
51
52
MANILA (BUSINESS)
53
54
JAKARTA (ECONOMY)
55
56
JAKARTA (PREMIUM ECONOMY)
57
58
JAKARTA (BUSINESS)
59
60
BANGKOK (ECONOMY)
61
62
BANGKOK (PREMIUM ECONOMY)
63
64
BANGKOK (BUSINESS)
65
66
APPENDIX A: RUBRIC
Matric ID CA16041
Section No. 3B
67
/25m
Display of outputs 5m
68
Course Outcome Total mark
Mark gained = (weightage item/ total weightage) x (score gained/5) x total mark
69
CO3 Differentiate various techniques in solving a problem
LEVEL OF ACHIEVEMENT
CRITERIA Weightage Mark
0 1 2 3 4 5
Rarely
LL1.1.1 Organize information using Always LL1.1.1 1.5
completes Completes
different symbols/ pseudo code completes
required required works, LL1.1.2 1
statement. required
works, and and show
works, and LL1.1.3 0.5 40
LL1.1.2 Organize information using rarely show ability to
show ability
appropriate input/ output variables ability to organize LL1.1.4 - 1
to organize
and statement. organize information
information
information related to
related to
LL1.1.3 Organize information using related to subject
subject
different arithmetic operators and subject
operands.
Total 5 50
70
71