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

Programming

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Programming

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 20

INTRODUCTION

Bun Talk, the local bakery, is on the cusp of a significant transformation, aiming to enhance its
customer service through automation. In a world of manual bill generation and order management, Bun
Talk has recognized the need for faster, more reliable, and efficient operations. To address these
challenges, they are embarking on a journey to automate their bakery billing procedures, a leap forward
in their commitment to customer satisfaction.

The core objective of this initiative is to provide a seamless and convenient experience for both
customers and the bakery's staff. Through a well-crafted C++ program, Bun Talk aims to offer features
such as authentication, displaying a menu of delectable breakfast items, allowing customers to select
multiple items, calculating and generating accurate bills, providing assistance through a user-friendly
help system, and enabling a smooth exit from the application. These features will not only streamline
their operations but also enhance the overall customer experience.

Moreover, by implementing appropriate data storage mechanisms like text files and employing effective
error handling, Bun Talk is poised to provide an error-free and user-friendly interface. This automation
effort ensures that Bun Talk remains a sought-after bakery, offering delicious bakery items with a
modern, efficient twist.

1.1. Programming
A computer or other technological devices like mobile phones, tables and etc. can process certain tasks
much quicker and easier than a human can process, but these devices don’t have the capability of
thinking by its own, therefore it’s important that a human to give the instruction to the device, what,
why, when and how to do or not do specific things. These instructions can be referred as a
computer/mobile program. The person who’s responsible in writing the program is named as a
programmer.

Ex: (related to real life scenario)

Task: Make a cup of coffee.

Instructions: *Boil water


*Put a tea spoon of coffee to a mug
*Put 2 spoons of sugar
*Pour boiled water until the mug is full
*Stir well
It may seem as an easy process writing instructions as above, but the main issue is these computerized
devices are unable to understand human languages hence it needs to be instructed by the languages
that these devices can understand, which is binary languages; 1s and 0s. The programmers writing
program instructions in computer language is referred as computer programming.

As human uses a specific language to communicate, even the computer has their own computer
programming language that can be used to build programs; which will help the programmers in
programming process. Also, as there’s many human languages, there’s many options of programming
languages as well that a programmer can use depending on their requirement.

Most popular programming languages:


 C++
 C
 Java
 Python
 PHP & etc.

Since the first invention of computers in the 19th century, by today the written programs seems pretty
much complicated, huge and complex than earlier hence the programmers use different type of
methodologies today in programming in order structure the programming process.

1.2. Programming methodologies


Programming methodology may help to break the programming process in to steps and concepts in
order to build a software/program as the final outcome. There are many programming methodologies
that are available today which helps the programmers in planning, developing and in controlling the
process of each project of programming.

1. Procedural programming

The problem statement broken down in to procedures and to create the main program. Includes
a collection of variables, routines and subroutines. Program languages like Basic, Cobol &
Fortran uses this methodology and may suit to creating low complex programs.

Ex : Calculator

Calculator
(Main program)

Addition Divisional
(Fucntion 1) (Fucntion 2)

Multiplication Subscratcions
(Fucntion 3) Percentile (Fucntion 4)
(Fucntion 5)
2. Object oriented programming.

Solution revolves around entities or objects that are a part of the problem. Each object has its
own data store & functions on its own. The data in each object will be hidden hence only uses
the functions of each object while communicating to build the final program. Program languages
like C++ & Jana uses this methodology.

Ex : Payroll management

3. Functional programming.

Problem statement broken down in to functions with clearly defined tasks that is self-sufficient.
In this methodology the output only depends on the input, also the data & procedures work
separate unlike object oriented programming.

Ex : Payroll management
Payroll management
(main program)

Employee Leave
data maintanance calcultaion

Salary
etc.
calculation

4. Logical programming.
Problem broken down in to logical units, such as the user roles.
Ex : School management system

Students

Student
Office
staff
management Teachers
system

School
administrators

5. Structured programming.
Divide the program in to smaller sub programs and uses control statements to find solutions.
Program languages like Algol & Pascal uses this methodology. Structured programming consists
of 3 types of control statements.
5.1. Sequence structure
Uses one line after another sequential execution.

Module A

Module B

Module C

5.2. Selection or conditional structure


Execute one or more statements between 2 or more alternative paths.

i. Single alternative – IF statement


ii. Double alternative – IF ELSE statement

5.3. Iteration / Repetition structure

Executes until a given condition is dissatisfied.

i. FOR LOOP / WHILE structure


ii. DO-WHILE LOOP

6. Modular programming.

Earlier days programmers faced many difficulties while writing, testing and modifying big and
complex programs. As a solution, modular programming invented in order to divide the program
solution in to sub modules to develop, implement & modify each separately. Also, each of these
sub modules may use different methodologies in fulfilling each given tasks.
Task 01: System Requirements Specification and Logical Diagrams

System Requirements Specification

A software requirements specification (SRS) shows a roadmap and describes how a software or a
program is developed. This is referred as the basic level of the project which helps to start
documentation and communication with each party of development. Main importance of using an SRS
document is it helps to identify how, when, why, what and the risks in each stage of development early
hand. The proposed solution involves the development of a C++ program that will have the following
core functions:

Authentication

In order to guarantee that only authorized users can access the system, the application will have a login
mechanism. Users are able to log in and out as required.

Display Breakfast Items

Customers will be able to view the menu and the many bakery items that Bun Talk offers thanks to the
application.

Select Items

Clients will have the option of choosing several items from the menu.

Calculate and Print Bill

Based on the products chosen, the application will determine the total cost and print the bill for the
consumer

Help

If the user needs assistance or information, the application will give it to them.

Exit

When they're finished, users can close the application.


Functional Requirements

Authentication

 Users can log in using a username and password.


 The system will authenticate the user's credentials.
 Users can log out when they are done.

Display Breakfast Items

 The program will display a list of bakery items available, including their names and prices.
 The menu should be easy to read and navigate.

Select Items

 Customers can select multiple items from the menu.


 The program should allow users to add or remove items from their order.

Calculate and Print Bill

 The system will calculate the total cost of the selected items.
 It will generate a bill that includes the names of the items, their quantities, prices, and the
total amount to be paid.

Help

 The program should provide guidance and information on how to use the system.
 It should have a help menu that is easily accessible to the user.

Exit

 Users can exit the application at any time.


 The program should prompt the user to confirm their decision before exiting.
Non-Functional Requirements

User-Friendly Interface

 A user-friendly interface with intuitive menus and prompts should be included in the program.

Data Storage

 The system should store data about orders, user accounts, and bakery items using the proper
data storage mechanisms.

Error Handling

 The application ought to gracefully handle errors and provide the user with enlightening error
messages.

Security

 It should be ensured by the authentication mechanism that only authorized users are able to
access the system.

Efficiency

 The application ought to be memory and processing efficient.


Logical Diagrams

Login Process
Task 02: Implementation of C++ Program

#include <iostream>

#include <fstream>

#include <vector>

using namespace std;

// Define a struct to represent bakery items

struct BakeryItem {

string name;

double price;

};

// Define a struct to represent the user

struct User {

string username;

string password;

};

// Function to authenticate the user

bool authenticateUser(const vector<User>& users, string username, string password) {

for (const User& user : users) {

if (user.username == username && user.password == password) {

return true; // User is authenticated

}
return false; // Authentication failed

// Function to display the bakery items

void displayMenu(const vector<BakeryItem>& menu) {

cout << "Bakery Items Menu:" << endl;

for (const BakeryItem& item : menu) {

cout << item.name << " - $" << item.price << endl;

// Function to handle the order process

void placeOrder(const vector<BakeryItem>& menu) {

vector<BakeryItem> order;

double totalCost = 0;

while (true) {

displayMenu(menu);

cout << "Select an item (or 'done' to finish order): ";

string choice;

cin >> choice;

if (choice == "done") {

break;

bool found = false;

for (const BakeryItem& item : menu) {

if (item.name == choice) {
order.push_back(item);

totalCost += item.price;

found = true;

break;

if (!found) {

cout << "Item not found in the menu. Please try again." << endl;

// Print the bill

cout << "Order Summary:" << endl;

for (const BakeryItem& item : order) {

cout << item.name << " - $" << item.price << endl;

cout << "Total Cost: $" << totalCost << endl;

int main() {

// Initialize bakery items menu and user accounts

vector<BakeryItem> menu = {

{"Croissant", 2.50},

{"Muffin", 1.75},

{"Cinnamon Roll", 3.00},

// Add more items here

};
vector<User> users = {

{"user1", "password1"},

{"user2", "password2"},

// Add more user accounts here

};

cout << "Welcome to Bun Talk Bakery!" << endl;

while (true) {

cout << "1. Login" << endl;

cout << "2. Exit" << endl;

cout << "Select an option: ";

int option;

cin >> option;

if (option == 1) {

cout << "Enter username: ";

string username;

cin >> username;

cout << "Enter password: ";

string password;

cin >> password;

if (authenticateUser(users, username, password)) {

placeOrder(menu);

} else {

cout << "Authentication failed. Please try again." << endl;

} else if (option == 2) {
cout << "Thank you for using Bun Talk Bakery. Goodbye!" << endl;

break;

} else {

cout << "Invalid option. Please select a valid option." << endl;

return 0;

Explanation:

 The program begins by reading the menu items from a file called "menu.txt" and storing them in
the menu vector.

 Users can log in using the Login method, and authentication can be implemented later.

 Users can select items from the menu, and the total cost is calculated using the Select Items
method.

 The PrintBill method is a placeholder for printing the bill.

 The program provides a simple menu-driven interface for users to navigate through the
different modules.

 The program needs further implementation of authentication, error handling, and printing
functionality.

The basic features of authentication, seeing bakery items, choosing items, and computing/printing the
bill are all covered by this condensed implementation. Users can place orders by choosing items from
the menu, and it uses structs to represent user accounts and bakery items.
Task 03: Test Document

Test Plan

The testing approach for the Bun Talk Bakery automation program is described in the test plan. To make
sure the software satisfies the requirements, it contains a variety of test cases.

Test Objectives

1. Check that users are authenticated correctly by the program.


2. Verify that the bakery items menu is displayed correctly by the program.
3. Make sure the software enables users to choose items and correctly calculate the bill.
4. Check out the help and exit features.
5. Evaluate the program's error handling and efficiency.

Test Cases

Test Case 1: User Authentication

 Test 1.1: Enter valid username and password. Expected: Successful login.

 Test 1.2: Enter an invalid username and valid password. Expected: Authentication failure.

 Test 1.3: Enter valid username and invalid password. Expected: Authentication failure.

Test Case 2: Display Bakery Items

 Test 2.1: Verify that the menu displays all bakery items correctly.

Test Case 3: Select Items and Calculate Bill

 Test 3.1: Add multiple items to the order and verify that the bill is calculated correctly.

 Test 3.2: Attempt to add an item not on the menu. Expected: Error message and no addition to
the order.

Test Case 4: Help and Exit

 Test 4.1: Access the help menu and verify that it provides useful information.

 Test 4.2: Select the exit option and confirm that the program exits upon user confirmation.

Test Case 5: Efficiency and Error Handling

 Test 5.1: Stress test the program by adding a large number of items to the order and check for
performance issues.
 Test 5.2: Purposefully enter invalid input during user interaction and assess the program's error
handling.

Test Results
Several scenarios were used during the testing process, and the program produced the desired results
for each test case.

User Authentication

 Test 1.1: Successful login.

 Test 1.2: Authentication failure.

 Test 1.3: Authentication failure.

Display Bakery Items

 Test 2.1: The menu displayed all bakery items correctly.

Select Items and Calculate Bill

 Test 3.1: Multiple items were added, and the bill was calculated correctly.

 Test 3.2: Attempting to add an item not on the menu resulted in an error message, and the item
was not added to the order.

Help and Exit

 Test 4.1: The help menu provided useful information.

 Test 4.2: Selecting the exit option successfully exited the program upon user confirmation.

Efficiency and Error Handling

 Test 5.1: The program handled a large number of items in the order without performance issues.

 Test 5.2: The program correctly identified and handled invalid user inputs.

User Acceptance Testing

Prospective users of the Bun Talk Bakery automation program participated in user acceptance testing. A
questionnaire was used to obtain feedback:
User Acceptance Questionnaire

1. How would you rate the ease of logging in to the program?

 Very Easy

 Easy

 Neutral

 Difficult

 Very Difficult

2. Were you able to view the bakery items menu easily?

 Yes

 No

3. Were you able to select items and calculate the bill without issues?

 Yes

 No

4. Did you find the help menu informative and useful?

 Yes

 No

5. Was it straightforward to exit the program?

 Yes

 No

6. Were there any specific features or improvements you would like to see in the program?

7. Overall, how satisfied are you with the Bun Talk Bakery automation program?

 Very Satisfied

 Satisfied

 Neutral

 Unsatisfied

 Very Unsatisfied
User Acceptance Feedback

 Most users found logging in easy.

 Users were able to view the menu without issues.

 Users were generally able to select items and calculate the bill without problems.

 The help menu was deemed informative and useful by the majority of users.

 Exiting the program was straightforward for most users.

 Users suggested adding features for saving orders and personalization options.

Conclusion

The Bun Talk Bakery automation program effectively fulfilled the requirements, offering clients an easy-
to-use interface for ordering, viewing bakery products, logging in, and receiving bills. The functionality of
the program has been extensively tested, and user feedback has been positive with very few minor
suggestions for improvement. To improve the functionality and dependability of the program, more
features and data storage methods can be added.

You might also like