0% found this document useful (0 votes)
209 views

ASM 2 1618: Programming: Computer Programming FPT University

This document provides an assignment brief for a programming assignment involving application development using an integrated development environment (IDE). The assignment requires students to choose from one of several case studies to develop a working application that incorporates programming paradigms and adheres to coding standards. Students must submit a report explaining their program, use of programming paradigms, features of the IDE used, debugging process, and coding standards. The working application must also be demonstrated.

Uploaded by

Tuấn Anh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
209 views

ASM 2 1618: Programming: Computer Programming FPT University

This document provides an assignment brief for a programming assignment involving application development using an integrated development environment (IDE). The assignment requires students to choose from one of several case studies to develop a working application that incorporates programming paradigms and adheres to coding standards. Students must submit a report explaining their program, use of programming paradigms, features of the IDE used, debugging process, and coding standards. The working application must also be demonstrated.

Uploaded by

Tuấn Anh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

ASM 2 1618: Programming

Computer Programming
FPT University
29 pag.

Document shared on www.docsity.com


Downloaded by: nguyen-trinh-anh-tuan-btec-dn ([email protected])
Higher National in Computing

Unit 1: Programming

ASSIGNMENT 2

Name: Dong Sy Nhat Thanh


ID: GCS210033
Class: GCS1003A
Subject code: 1618

Assignment due: Assignment submitted:

Page | 1

Document shared on www.docsity.com


Downloaded by: nguyen-trinh-anh-tuan-btec-dn ([email protected])
ASSIGNMENT 2 FRONT SHEET

Qualification BTEC Level 5 HND Diploma in Computing

Unit number and title Unit 1: Programming

Submission date Date Received 1st submission

Re-submission Date Date Received 2nd submission

Student Name Dong Sy Nhat Thanh Student ID GCS210033

Class Assessor name Nguyen Tuan Dang

Student declaration
I certify that the assignment submission is entirely my own work and I fully understand the consequences of plagiarism. I understand that
making a false declaration is a form of malpractice.

Student’s signature
Grading grid
P2 P3 P4 P5 M2 M3 M4 D2 D3 D4

Page | 2

Document shared on www.docsity.com


Downloaded by: nguyen-trinh-anh-tuan-btec-dn ([email protected])
 Summative Feedback:  Resubmission Feedback:

Grade: Assessor Signature: Date:


Lecturer Signature:

Page | 3

Document shared on www.docsity.com


Downloaded by: nguyen-trinh-anh-tuan-btec-dn ([email protected])
Assignment Brief 2 (RQF)
Higher National Certificate/Diploma in Computing
Student Name/ID Number:

Unit Number and Title: Unit 1: Programming

Academic Year: 2021 – 2022

Unit Assessor: Vinh Hoang

Assignment Title: Application development with IDE

Issue Date: 10 September 2021

Submission Date:

Internal Verifier Name:

Date:

Submission Format:

Page | 4

Document shared on www.docsity.com


Downloaded by: nguyen-trinh-anh-tuan-btec-dn ([email protected])
Format:
● The submission is in the form of an individual written report. This should be written in a concise,
formal business style using single spacing and font size 12. You are required to make use of
headings, paragraphs and subsections as appropriate, and all work must be supported with
research and referenced using the Harvard referencing system. Please also provide a bibliography
using the Harvard referencing system.
Submission
● Students are compulsory to submit the assignment in due date and in a way requested by the
Tutor.
● The form of submission will be a soft copy posted on http://cms.greenwich.edu.vn/.
● Remember to convert the word file into PDF file before the submission on CMS.
Note:
● The individual Assignment must be your own work, and not copied by or from another student.
● If you use ideas, quotes or data (such as diagrams) from books, journals or other sources, you
must reference your sources, using the Harvard style.
● Make sure that you understand and follow the guidelines to avoid plagiarism. Failure to comply
this requirement will result in a failed assignment.

Unit Learning Outcomes:

LO2 Explain the characteristics of procedural, object-oriented and event-driven programming, conduct
an analysis of a suitable Integrated Development Environment (IDE)
LO3 Implement basic algorithms in code using an IDE
LO4 Determine the debugging process and explain the importance of a coding standard

Assignment Brief and Guidance:

Page | 5

Document shared on www.docsity.com


Downloaded by: nguyen-trinh-anh-tuan-btec-dn ([email protected])
Assignment scenario
Scenario: You have applied for a post as a trainee with a software development company and have been
invited for an interview. You have been passed the presentation to demonstrate your problem solving and
basic programming skills. Now you are given a more challenge task to create a fully working, secure
application that has been developed using an IDE and adheres to coding standards for a detailed business
problem.

Tasks
You will discuss a suitable problem with your mentor and list the user requirements before designing,
implementing (coding) and testing a solution. You will create a report that should include:
● Introduction to your program (list of requirements and screenshots of program)
● Explain some of programming paradigms. Evaluate why and how your program use these (or some
of) paradigms.
● Explain the common features of an IDE should have and evidence of how the IDE was used to manage
the development of your code.
● An evaluation of developing applications using an IDE versus developing an application without using
an IDE.
● An explanation and evaluation of the debugging process in the IDE used and how it helped with
development.
● An explanation and evaluation of coding standards used in your program and the benefits to
organisations of using them.

The working application produced must also be demonstrated together with the presentation.

Case Studies
You can choose one of following case studies to implement

Hotel Management System:


A Hotel Management System is a software built to handle all online hotel activities easily and safely. This
System will give the hotel management power and flexibility to manage the entire system from a single
online portal. The system allows the manager to keep track of all the available rooms in the system as
well as to book rooms and generate bills.
1. The system should support the booking of different room types like standard, deluxe, family suite,
etc.
2. Guests should be able to search the room inventory and book any available room.
3. The system should be able to retrieve information, such as who booked a particular room, or
what rooms were booked by a specific customer.

Page | 6

Document shared on www.docsity.com


Downloaded by: nguyen-trinh-anh-tuan-btec-dn ([email protected])
Library Management System
A Library Management System is a software built to handle the primary housekeeping functions of a
library. Libraries rely on library management systems to manage asset collections as well as relationships
with their members. Library management systems help libraries keep track of the books and their
checkouts, as well as members’ subscriptions and profiles.
Library management systems also involve maintaining the database for entering new books and
recording books that have been borrowed with their respective due dates.
1. Any library member should be able to search books by their title, author, subject category as well by
the publication date.
2. The system should be able to retrieve information like who took a particular book or what are the
books checked-out by a specific library member.
3. User can add books with its information such as: title, author, publication date, category etc and
update it

Movie Ticket Booking System


An online movie ticket booking system facilitates the purchasing of movie tickets to its customers.
Eticketing systems allow customers to browse through movies currently playing and book seats,
anywhere and anytime.
1. Each cinema can have multiple halls and each hall can run one movie show at a time.
2. Each Movie will have multiple shows.
3. Customers should be able to search movies by their title, language, genre, release date, and city
name.
4. The customer should be able to select a show at a particular cinema and book their tickets.

Airline Management System


An Airline Management System is a managerial software which targets to control all operations of an
airline. Airlines provide transport services for their passengers. They carry or hire aircraft for this
purpose. All operations of an airline company are controlled by their airline management system.

This system involves the scheduling of flights, air ticket reservations, flight cancellations, customer
support, and staff management. Daily flights updates can also be retrieved by using the system. 1.
Customers should be able to search for flights for a given date and source/destination airport.
2. Customers should be able to reserve a ticket for any scheduled flight. Customers can also build a
multi-flight itinerary.
3. Users of the system can check flight schedules, their departure time, available seats, arrival time,
and other flight details.
4. The admin of the system can add new aircrafts, flights, and flight schedules. Admin can cancel
any pre-scheduled flight (all stakeholders will be notified).

Restaurant Management System


A Restaurant Management System is a software built to handle all restaurant activities in an easy and
safe manner. This System will give the Restaurant management power and flexibility to manage the

Page | 7

Document shared on www.docsity.com


Downloaded by: nguyen-trinh-anh-tuan-btec-dn ([email protected])
entire system from a single portal. The system allows the manager to keep track of available tables in
the system as well as the reservation of tables and bill generation.
1. The waiter should be able to create an order for a table and add meals for each seat.
2. Each meal can have multiple meal items. Each meal item corresponds to a menu item.
3. The system should be able to retrieve information about tables currently available to seat walk-
in customers.
4. The system should support the reservation of tables.

Page | 8

Document shared on www.docsity.com


Downloaded by: nguyen-trinh-anh-tuan-btec-dn ([email protected])
Learning Outcomes and Assessment Criteria (Assignment 2):
Learning Outcome Pass Merit Distinction
LO2 P2 Give explanations M2 Analyse the D2 Critically evaluate
of what procedural, common features that the source code of an
object-oriented and a developer has access application which
event-driven to in an IDE. implements the
paradigms are; their programming
characteristics and the paradigms, in terms of
relationship between the code structure and
them. characteristics.
LO3 P3 Write a program M3 Use the IDE to D3 Evaluate the use of
that implements an manage the an IDE for
algorithm using an development process development of
IDE. of the program. applications
contrasted with not
using an IDE.

LO4 P4 Explain the M4 Evaluate how the D4 Critically evaluate


debugging process debugging process can why a coding standard
and explain the be used to help is necessary in a team
debugging facilities develop more secure, as well as for the
available in the IDE. robust applications. individual.

P5 Outline the coding


standard you have
used in your code.

Page | 9

Document shared on www.docsity.com


Downloaded by: nguyen-trinh-anh-tuan-btec-dn ([email protected])
Table of Contents

Task 2 – Explain programming paradigms (P2) ......................................................................................... 11


1. Procedural paradigm ........................................................................................................................... 11
1.1 Introduction to computer programming language. .......................................................................... 11
1.2 Characteristics of procedural programming ..................................................................................... 11
2. Object-oriented paradigm................................................................................................................... 12
2.1 Definition of object-oriented programming ..................................................................................... 12
2.2 What are the characteristics of object-oriented programming languages? ..................................... 13
3. Event-driven paradigm........................................................................................................................ 14
3.1 Definition of Event-driven paradigm................................................................................................. 14
3.2 Characteristic of Event-driven paradigm .......................................................................................... 14
4. Relationship between Object-oriented and Event-driven paradigm ............................................ 15

Task 1 – Introduction to your program (P3) .............................................................................................. 16


1. Explain my code .................................................................................................................................. 16
2. Result.................................................................................................................................................. 19

Task 3 – IDE features (P4)........................................................................................................................... 21


1. Debugging process .............................................................................................................................. 21
1.1. Definition.......................................................................................................................................... 21
1.2. Description ....................................................................................................................................... 21
2. Explain the debugging facilities available in the IDE ........................................................................... 21
2.1. Debugging in IDE .............................................................................................................................. 21
2.2. Debugging tools ............................................................................................................................... 22

Task 4 – Design and Implementation (P5) ................................................................................................. 23


1. Rule of brackets................................................................................................................................... 23
2. Tab, whitespace .................................................................................................................................. 24
3. Comment............................................................................................................................................. 25
Appendix ................................................................................................................................................. 26
References ................................................................................................................................. 28

Page | 10

Document shared on www.docsity.com


Downloaded by: nguyen-trinh-anh-tuan-btec-dn ([email protected])
Assignment 2

Task 2 – Explain programming paradigms (P2)

1. Procedural paradigm:

1.1 Introduction to computer programming language.

A programming language is a formal language that contains a set of generated instructions


different output types. Programming languages are used in computer programming to
implement algorithm. computer programming language, one of several languages that execute
directly when referred to as a machine in a computer manufacturer-specific numerical form
language, after a simple substitution process, when expressed in the appropriate assembly
language or after translation from an "advanced" language. Programming languages are also
divided into two types, which are "high-level" programming languages and "low-level"
programming languages.

1.2 Characteristics of procedural programming.

3.1. Predefined function: is a predefined function in the library of the system you are using.
Therefore, you can reuse the code in the system library

3.2 Libraries: In procedural programming, there are many libraries that contain functions and
subroutines within them. Programmers can easily use those functions by declaring them first.

3.3 Local variables: A local variable is declared within an initialized method, block or method and
it is limited to that one method. It only works within the method it's defined in, and it stops
working when it's out of the scope of that method.

3.4 Global variables: Unlike local variables, global variables are declared outside of any defined
methods, so they can be used by all functions.

3.5 Modularity:
It is a popular programming concept that involves breaking down a program into subroutines,
each of which has the necessary components to complete its work before being assembled into
an executable application program.

Page | 11

Document shared on www.docsity.com


Downloaded by: nguyen-trinh-anh-tuan-btec-dn ([email protected])
3.6 Passing parameters:
The method of passing parameters to functions, subroutines, and procedures is known as
parameter passing. It can be done with the letters "pass by value",
“pass by reference", "pass by result", "pass by result value" and "pass by name".

3.7 Procedures
When procedures are used, the program executes them in a top-down step-by-step manner. The
program does exactly what it is supposed to do by default.

2. Object-oriented paradigm:

2.1 Definition of object-oriented programming.

Object Oriented Programming (OOP) is a programming paradigm that uses classes and objects
to organize data. It's used to break down a software program into simple, reusable code
blueprints and to make individual instances of things. Object-oriented programming languages
include Ruby, C#, PHP and Python.

Our Case class, for example, might contain a component replacement function that modifies the
attributes of the computer case. Because this function is only relevant for objects like that, we
declare it as a method in the Case class.

Classes can also include functions, which seem to be functions that are exclusively available to
objects of that kind. These functions are defined in the class and perform various important tasks
for that specific object type. Individual objects are created using class templates as a blueprint.
They are concrete representations of abstract classes such as myCase. For properties defined in
the class, each object can have its own set of values.

Let's imagine we constructed a class called computer case that contains all of the necessary
attributes for a case, such as color, brand, and case style. To represent my computer's case, we
build an instance of an object of type Case, myCase.

To describe my computer's case, we can change the values of properties defined in the class
without impacting other objects or the class template. This class can then be used to represent
any number of computer scenarios.

Page | 12

Document shared on www.docsity.com


Downloaded by: nguyen-trinh-anh-tuan-btec-dn ([email protected])
Figure 1: My example flowchart

2.2 What are the characteristics of object-oriented programming languages?

Class definitions– OOP's essential building elements and a single entity that integrates data and
data operations.

Object – instances of a class, including their variables and actions, that are employed in real-
world functioning.

Abstraction - Specifying what to do but not how to do it, a useful feature for gaining a
comprehensive understanding of an object's capabilities.

Encapsulation – a class attribute that unifies data and data operations into a single unit.

Inheritance and class hierarchy - Reusability and extension of existing classes

Polymorphism – Functions with the same name but different functionality, saves time by not
having to invest in a large number of function names. Operator and function overloading

Page | 13

Document shared on www.docsity.com


Downloaded by: nguyen-trinh-anh-tuan-btec-dn ([email protected])
Generic classes – used to define data that isn't given. They're referred to as container classes.
They're flexible and adaptable.

Class libraries – Built-in language specific classes

Message Passing – a feature that allows you to transmit and receive data between objects via
function parameters.

3. Event-driven paradigm:

3.1 Definition of Event-driven paradigm.

Event-driven programming is a programming paradigm in which the flow of a program is


governed by events such as user actions, sensor data, or messages from other programs or
streams in computer programming. The prevalent programming paradigm in graphical user
interfaces and other programs that focus on doing specific actions in response to user input is
event-driven programming. The same is true when it comes to device driver programming.

A main loop in an event-driven application normally listens for events and then fires a callback
function when one of them is identified. Instead of a continually running main loop, hardware
interrupts can be used in embedded systems to achieve the same result. Event-driven programs
can be developed in any programming language, although languages with a high level of
abstraction, such as await and closure, make the work easier.

3.2 Characteristic of Event-driven paradigm

Service Oriented:
It is a crucial aspect in event-driven programming that is used to design programs for services. It
does not cause the computer to slow down because service-oriented programming uses less
processing power and services are normally operated in the background of the operating system.

Time Driven:
It's a pattern, it's code that runs on a timer, and it may also be specific code that runs at a specific
time, such as once an hour, once a week, or once a month, indicating that Time Driven is already
set up to do the work.

Event Handlers:
It's a type of function or method that performs a specific action in response to a certain event.
Consider the following scenario: When a user clicks on an event handler, it displays a message or
launches a program, and when the user clicks on it again, it closes.

Page | 14

Document shared on www.docsity.com


Downloaded by: nguyen-trinh-anh-tuan-btec-dn ([email protected])
Trigger Functions:
This is a function that determines what code should be executed when a specific event occurs; it
is used to determine which event handler should be utilized when a specific event occurs.

Events:
It contains the mouse, keyboard, and user interface, as well as what events in the program must
be triggered, implying that the user must interact with a program object. To "Pay respect" for a
character who died in a game, for example, double-click the mouse to open the application or
use the "F" key on the keyboard.

4. Relationship between Object-oriented and Event-driven paradigm

The programming languages Object-Oriented Programming (OOP) and Event-Driven


Programming (EDP) are orthogonal, which means they can be used in the same program.

In OOP with EDP, all OOP principles (encapsulation, inheritance, and polymorphism) are intact.

Objects with EDP in OOP can notify events and subscribe to event notifications from other
objects.

Control flow between objects is the difference between OOP and EDP.

In OOP without EDP, control moves from one object to another when a method is called. Objects
can effectively call the methods of other objects.

On event messages, go from object to object in OOP with EDP control. An object that receives
notifications from other objects waits for notifications from those objects, some of which act on
the message, before publishing its own message.

Page | 15

Document shared on www.docsity.com


Downloaded by: nguyen-trinh-anh-tuan-btec-dn ([email protected])
Task 1 – Introduction to your program (P3)

1. Explain my code:

❖At first, I'll declare the product's price and serial number. These declaration lines can be seen
in the image below. Every program requires a declaration because it works as a repository for the
program's values.

Figure 2: Declare price and serial numbers

After that, I added a few lines of code to allow the software to output the product's name and
price, which may also be liked to think of as a menu.

Figure 3: Create Menu

Page | 16

Document shared on www.docsity.com


Downloaded by: nguyen-trinh-anh-tuan-btec-dn ([email protected])
❖Then I add further commands to the software so that it prints a few more lines for consumers
to enter the serial number and quantity of the product they want to purchase. This is also the
place for the program to receive information from the customer and start calculating and finally
printing the price.

Figure 4: Enter serial number and quantity

❖ I also use a while statement to tell customers when they entered the wrong serial number.
For example, the product I show here is 6, however if they type a number higher than 6, it will
print "This product does not exist" and then show an additional line below it that says "re-enter
here: ".

Figure 5: Error Message

Page | 17

Document shared on www.docsity.com


Downloaded by: nguyen-trinh-anh-tuan-btec-dn ([email protected])
Figure 6: Discount product

❖ I used an If-else expression to create a product discount. In this scenario, I believe if-else is the
best option. When the quantity of a product reaches 5, the software reduces the price for the
customer by 2/5, and if the quantity does not exceed 5, the program prints the original price. The
else statement is used to apply the If statement to a different product. To get a better
understanding, take a look at the images below.

Page | 18

Document shared on www.docsity.com


Downloaded by: nguyen-trinh-anh-tuan-btec-dn ([email protected])
❖ And finally, here is the code used to print the price

Figure 7: Output the price

2. Result:

In this part, I will divide it into 3 pictures to be able to show the different uses of the
program.

Here is the program when there is no discount:

Figure 8: No discount

Page | 19

Document shared on www.docsity.com


Downloaded by: nguyen-trinh-anh-tuan-btec-dn ([email protected])
And here is the program when it has a discount:

Figure 9: Has a discount

And here is the program that notifies customers when they enter the wrong serial number:

Figure 10: Enter wrong serial number

Page | 20

Document shared on www.docsity.com


Downloaded by: nguyen-trinh-anh-tuan-btec-dn ([email protected])
Task 3 – IDE features (P4)

1. Debugging process:

1.1. Definition:

Debugging is the act of finding and removing existing defects as well as hidden bugs in software.
Hidden bugs in software frequently make the software crash. Debugging is a technique for
locating and correcting faults or problems. Debugging gets more challenging when several
subsystems or modules are tightly connected, because each change in one module can cause
more bugs to arise in another.

1.2. Description:

To debug a software, the user must first identify the problem, extract the code, and then correct
it. At various stages of development, debugging tools are used to uncover coding mistakes.
They're used to recreate the error's circumstances, then evaluate the program's state at the
moment to figure out what went wrong. A debugger is included in certain programming language
packs to test the errors while the code is being created at run time.

And here's the debugging procedure:

1. Rephrase the issue.

2. The description of the error.

3. When the mistake occurs, take a photo of the application.

4. Analyze snapshots depending on status and actions.

5. Fix any bugs that have already been discovered.

2. Explain the debugging facilities available in the IDE:

2.1. Debugging in IDE


The basic debugging tool of the IDE debugger is GDB. Each GUI action is converted into a series
of GDB commands, which are then processed to monitor the current status of the debugged
program.

Page | 21

Document shared on www.docsity.com


Downloaded by: nguyen-trinh-anh-tuan-btec-dn ([email protected])
2.2. Debugging tools

❖ Code editor: GDB is the IDE debugger's primary debugging tool. Each GUI action is translated
into a series of GDB commands, which are then processed to keep track of the debugged
program's current state.

❖ Translators: Programmers who translate high-level programming terminology into machine


code are known as translators. The IDE will feature at least one compiler, allowing you to run
your code and check for syntax and logic errors.

❖ Code highlighting: When an IDE discovers a syntax error, it will typically assist you by
highlighting the code portion where the error was found.

❖ Breakpoints: An IDE breakpoint is a handy tool for pausing a program at a specific line of code
to examine the value of variables.

❖ Step over: You may need to run the line of code after the debugger reaches the breakpoint.
The command "Step Over" is used to run the code.

❖ Simply Inspect Variables: In a data tip, you can see the current value of a variable by hovering
over it.

❖ Step into: Step Over is a similar game. The only difference is that the debugger will travel into
the method if the current highlighted part contains a method call. Step's shortcut key

❖ Step out: This has something to do with debugging within a method. If you press Shift + F11
while in the middle of a method, the execution will finish the method and pause at the next
sentence from where it was called.

❖ Run to cursor: To place the cursor on a line of executable code, run to the cursor point in the
source window. This is akin to setting a temporary breakpoint.

❖ Inspect Variables:

+ Variables specified in the local scope are displayed in the Locals pane.

+ The Autos window shows the variables that have been utilized in the current line.

+ During a debugging session, we can utilize Watch and QuickWatch to see variables and
expressions.

Page | 22

Document shared on www.docsity.com


Downloaded by: nguyen-trinh-anh-tuan-btec-dn ([email protected])
+ The Watch window can show many variables at once, whereas the QuickWatch Window only
shows one variable at a time.

Task 4 – Design and Implementation (P5)

1. Rule of brackets:

Figure 11: brackets

Page | 23

Document shared on www.docsity.com


Downloaded by: nguyen-trinh-anh-tuan-btec-dn ([email protected])
I've outlined some brackets in my program so you can easily figure out what and where it is, this
is makes it easier for me to manage my code when writing multiple nested blocks of code.
2. Tab, whitespace:

Figure 12: tab

Figure 13: whitespace

+As you can see in Figure 12, I've moved back to a tab so that it's easier to see the relationship
between the command lines.

+In Figure 13, I created a space between the "Add Student Grade" and "Add Student ID" sections,
which separates the two lines of code mainly to help programmers easily identify them.

Page | 24

Document shared on www.docsity.com


Downloaded by: nguyen-trinh-anh-tuan-btec-dn ([email protected])
3. Comment:

Figure 14: comment

You can see green text on my lines, which are also relatively important for large projects. It is
used to explain the purpose of lines of code, so that other programmers working on that
project will know what the code does.

Page | 25

Document shared on www.docsity.com


Downloaded by: nguyen-trinh-anh-tuan-btec-dn ([email protected])
APPENDIX
using System;

namespace ConsoleApp_ASM_1
{
class program
{
static void Main(string[] args)
{
//declare the cost for product
double a1 = 10000;
double b2 = 20000;
double c3 = 30000;
double d4 = 40000;
double e5 = 50000;
double f6 = 60000;

//conditions for the program to run the line of code


double numbers = 0;
double product = 0;
double price = 0;

//create menu
Console.WriteLine("Welcome to The God Damn Store");
Console.WriteLine("========================== #
==========================");
Console.WriteLine("1. God Damn Gun ($10000)");
Console.WriteLine("2. God Damn Sword ($20000)");
Console.WriteLine("3. God Damn Bomb ($30000)");
Console.WriteLine("4. God Damn Pet ($40000)");
Console.WriteLine("5. God Damn Helmet ($50000)");
Console.WriteLine("6. God Damn Suit ($60000)");
Console.WriteLine("========================== GOD DAMN
==========================");

//lines for customers enter their choice


Console.WriteLine("Hey warrior! Enter your god damn product serial
number in here: ");
product = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Now, enter the quantity of the product you want to
buy: ");
numbers = Convert.ToInt32(Console.ReadLine());

//error line
while (product > 6)
{
Console.WriteLine("This product doesn't exist");
Console.WriteLine("re-enter here: ");
product = Convert.ToDouble(Console.ReadLine());
}

//create discount function


if (product == 1)
{
if (numbers > 5)

Page | 26

Document shared on www.docsity.com


Downloaded by: nguyen-trinh-anh-tuan-btec-dn ([email protected])
price = numbers * (a1 * 2 / 5);
else
price = numbers * (a1);
}
else
{
if (product == 2)
{
if (numbers > 5)
price = numbers * (b2 * 2 / 5);
else
price = numbers * (b2);
}
else
{
if (product == 3)
{
if (numbers > 5)
price = numbers * (c3 * 2 / 5);
else
price = numbers * (c3);
}
else
{
if (product == 4)
{
if (numbers > 5)
price = numbers * (d4 * 2 / 5);
else
price = numbers * (d4);
}
else
{
if (product == 5)
{
if (numbers > 5)
price = numbers * (e5 * 2 / 5);
else
price = numbers * (e5);
}
else
{
if (product == 6)
{
if (numbers > 5)
price = numbers * (f6 * 2 / 5);
else
price = numbers * (f6);
}
}
}
}
}
}
Console.WriteLine("--THANK YOU FOR BUYING MY GOD DAMN PRODUCT--");
Console.WriteLine("Here is the prices: ${0}", price);
}
}

Page | 27

Document shared on www.docsity.com


Downloaded by: nguyen-trinh-anh-tuan-btec-dn ([email protected])
REFERENCES
1. UKEssays.com. (2017). Event-Driven Programming Features. [online] Available at:
https://www.ukessays.com/essays/computer-science/eventdriven-programming-
features-6167.php.

2. Wikipedia Contributors (2019). Procedural programming. [online] Wikipedia. Available at:


https://en.wikipedia.org/wiki/Procedural_programming.

3. What is Procedural Programming? Key Features of Procedural Programming (2019). What


is Procedural Programming? Key Features of Procedural Programming. [online] Hackr.io.
Available at: https://hackr.io/blog/procedural-programming.

4. Doherty, E. (2020). What is Object Oriented Programming? OOP Explained in Depth.


[online] Educative: Interactive Courses for Software Developers. Available at:
https://www.educative.io/blog/object-oriented-programming.

5. Tutorial Links. (n.d.). Basic Characteristics of Oops. [online] Available at:


https://tutorialslink.com/Articles/Basic-Characteristics-of-Oops/1308.

6. moviecultists.com. (n.d.). What is event driven programming? [online] Available at:


https://moviecultists.com/what-is-event-driven-programming [Accessed 8 Mar. 2022].

7. mok (2014). What is the relation of “Event Driven” and “Object Oriented”
programming? [online] Stack Overflow. Available at:
https://stackoverflow.com/questions/22101731/what-is-the-relation-of-event-driven-
and-object-oriented-programming.

8. The Economic Times (2019). What is Debugging? Definition of Debugging, Debugging


Meaning - The Economic Times. [online] The Economic Times. Available at:
https://economictimes.indiatimes.com/definition/debugging.

9. CodeLearn (n.d.). Coding Standards Và Cách Viết Code C++ Chuẩn Đẹp. [online]
codelearn.io. Available at: https://codelearn.io/sharing/coding-standards-va-cach-viet-
code-cpp?fbclid=IwAR03A5oGlEedwVTyf5SfEa1FY2r4rKItL62jyuvhdVjFUA6G5iT1sCZ3lfE
[Accessed 6 Mar. 2022].

Page | 28

Document shared on www.docsity.com


Downloaded by: nguyen-trinh-anh-tuan-btec-dn ([email protected])
10. www.javatpoint.com. (n.d.). Programming Language | What is Programming Language -
Javatpoint. [online] Available at: https://www.javatpoint.com/programming-language.

Page | 29

Document shared on www.docsity.com


Downloaded by: nguyen-trinh-anh-tuan-btec-dn ([email protected])

You might also like