You are on page 1of 4

Atılım University

Department of Computer Engineering

CMPE 113 Computer Programming-I


2021 - 2022 Fall
ASSIGNMENT-2
Due Date: 24.12.2021 23:59

WARNINGS
 You should upload your homework to the Moodle System before the due
date.
 Late submissions will NOT be graded.
 The name of the homework file should be “StudentId_hw2.c” for example
“11122233_hw2.c”
 Do NOT use Turkish characters when you give name to your C file.
 Your homework must be a C file not CPP.
 You should use indentation and comments in your code.
 Do NOT upload .exe file. You should upload the source code.
Otherwise you will get ZERO.
 Group study is not allowed. Everyone needs to do his/her
homework as an individual.
 Do not share your solution with others.
 Your codes will be checked by special software for code similarity. If the
code similarity between any two or more submissions is higher than
%90, the codes involved will also examined and compared by eye. If it is
convinced that the similarity between two codes is not merely a
coincidence, all involved HWs will get 0 as the grade.

GRADING POLICY: If your code can not run at all (due to compile errors,
etc.) or as expected, your code will be evaluated over 80 points instead of
100.
In a café, suppose that there are four drinks on the menu and you are asked
to write a complete C program to take orders and calculate the total amount
that needs to be paid. The drinks available on the menu and their prices are
listed below.
1. Espresso 4.5$
2. Latte 5.5$
3. Cappuccino 6.5$
4. Tea 3.5$
First, the program should ask the customer how many drinks will be ordered.
Then, print the available options on the menu. After that, the program
should take the orders according to the number of the drink on the menu.
For example, if the user gives 2 as an input to the program, it means that
the customer has ordered one latte. After each order, print what the order
was and how much it costs.
After taking the total amount of orders that needed to be taken, ask the
customer if the bill is to be split between the total amount of customers that
placed orders or not. If the user inputs the character y (or Y) for yes, split the
total cost between the total number of customers and print that value. If the
user inputs the character n (or N) for no, print the total cost.
Check Sample Runs for a detailed demonstration of how your program
should work.

Sample Run-1:
Welcome! How many drinks will be ordered?
3
MENU:
1. Espresso
2. Latte
3. Cappuccino
4. Tea
1
You have ordered one Espresso, which costs 4.5$
2
You have ordered one Latte, which costs 5.5$
4
You have ordered one Tea, which costs 3.5$
Would you like to split the bill between 3 guests?
Y
The amount that each guest needs to pay is 4.50$

Sample Run-2:
Welcome! How many drinks will be ordered?
6
MENU:
1. Espresso
2. Latte
3. Cappuccino
4. Tea
3
You have ordered one Cappuccino, which costs 6.5$
2
You have ordered one Latte, which costs 5.5$
4
You have ordered one Tea, which costs 3.5$
1
You have ordered one Espresso, which costs 4.5$
4
You have ordered one Tea, which costs 3.5$
2
You have ordered one Latte, which costs 5.5$
Would you like to split the bill between 6 guests?
y
The amount that each guest needs to pay is: 4.83$

Sample Run-3:
Welcome! How many drinks will be ordered?
5
MENU:
1. Espresso
2. Latte
3. Cappuccino
4. Tea
3
You have ordered one Cappuccino, which costs 6.5$
3
You have ordered one Cappuccino, which costs 6.5$
1
You have ordered one Espresso, which costs 4.5$
2
You have ordered one Latte, which costs 5.5$
4
You have ordered one Tea, which costs 3.5$
Would you like to split the bill between 5 guests?
n
The total amount that you need to pay is: 26.50$

Sample Run-4:
Welcome! How many drinks will be ordered?
2
MENU:
1. Espresso
2. Latte
3. Cappuccino
4. Tea
4
You have ordered one Tea, which costs 3.5$
4
You have ordered one Tea, which costs 3.5$
Would you like to split the bill between 2 guests?
N
The total amount that you need to pay is: 7.00$

You might also like