0% found this document useful (0 votes)
103 views74 pages

FOC DOCUMENTATION Sem - 2 NEwwwww

This document outlines an assignment for a Fundamentals of Computing course to design a program for tracking laptop inventory using Python. It includes 12 sections that discuss the introduction, goals, design process, pseudocode, data structures, program, testing, and conclusion. The assignment is due on May 12th, 2023 and requires a word count between 6,833 words. Late submissions will not be accepted.

Uploaded by

mrarpann22
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
103 views74 pages

FOC DOCUMENTATION Sem - 2 NEwwwww

This document outlines an assignment for a Fundamentals of Computing course to design a program for tracking laptop inventory using Python. It includes 12 sections that discuss the introduction, goals, design process, pseudocode, data structures, program, testing, and conclusion. The assignment is due on May 12th, 2023 and requires a word count between 6,833 words. Late submissions will not be accepted.

Uploaded by

mrarpann22
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 74

Module Code & Module Title:

CS4051NT Fundamentals of Computing

Assessment Weightage & Type:


60% Individual Coursework

Year and Semester:


2022 Autumn
Year – 1st
Semester – 2nd

Student Name: Arpan karki


London Met ID: 22072096
College ID: NP05CP4A220024
Assignment Due Date: May 12, 2023
Word Count: 6833

I confirm that I understand my coursework needs to be submitted online via MySecondTeacher under the
relevant module page before the deadline in order for my assignment to be accepted and marked. I am
fully aware that late submissions will be treated as non-submission and a mark of zero will be awarded.
Table of Contents
1. Introduction ............................................................................................................... 1

Introduction about the project ...................................................................................... 2

2. Goals and objectives ................................................................................................ 2

Goal ............................................................................................................................. 2

Objectives .................................................................................................................... 3

3. Discussion and Analysis ........................................................................................... 4

Algorithm ..................................................................................................................... 4

Flowchart......................................................................................................................... 7

4. Pseudocode ............................................................................................................ 10

Pseudocode For Main.py ........................................................................................... 11

Pseudocode code for Read.py .................................................................................. 14

PseudoCode For Sell.py ............................................................................................ 16

Pseudocode For Invoice.py ....................................................................................... 18

Pseudocode For Add.py ............................................................................................ 21

5. Data Structures ....................................................................................................... 24

6. Program .................................................................................................................. 30

Overall program with short explanation ..................................................................... 30

Show the selling and adding laptop complete process. ............................................. 33

Creation of txt file ....................................................................................................... 35

Opening txt and show the bill. .................................................................................... 36

Showing the termination of program .......................................................................... 37

7. Testing .................................................................................................................... 38

Test 1......................................................................................................................... 38

Test 2:........................................................................................................................ 39
Test 3......................................................................................................................... 41

Test 4......................................................................................................................... 44

Test 5......................................................................................................................... 45

8. Conclusion .............................................................................................................. 50

9. Appendix ................................................................................................................. 51

10. References .......................................................................................................... 69

11. Report.................................................................................................................. 70

List of Figures
Figure 1 : Logo of Python Programming Language ......................................................... 1
Figure 2 : Basic Flowchart ............................................................................................... 7
Figure 3 : Flowchart of my Program ................................................................................ 9
Figure 4 : In my program, integer is used. ..................................................................... 24
Figure 5 : Float also used in my program. ..................................................................... 25
Figure 6 : In my program Boolean is used..................................................................... 26
Figure 7 : In my program List is used. ........................................................................... 27
Figure 8 : Example of Tuple. ......................................................................................... 28
Figure 9 : Example of Set. ............................................................................................. 28
Figure 10 : Example of Dictionary. ................................................................................ 29
Figure 11 : Modules of my Program. ............................................................................. 30
Figure 12 : Complete process of Add Quantity. ............................................................. 33
Figure 13 : Complete process of Selling Laptops. ......................................................... 34
Figure 14 : Complete process of making txt file. ........................................................... 36
Figure 15 : Generate Text file after selling laptop. ......................................................... 36
Figure 16 : Exit part of my program. .............................................................................. 37
Figure 17 : Giving String input where inputs integer value. ........................................... 38
Figure 18 : Provide negative value in quantity. .............................................................. 39
Figure 19 : Provide none existed value in quantity. ....................................................... 40
Figure 20 : Step 1st before selling the laptop. ............................................................... 41
Figure 21 : Show selling output in shell. ........................................................................ 42
Figure 22 : Show the renting in txt file. .......................................................................... 43
Figure 23 : Display option before display laptop. ........................................................... 44
Figure 24 : Exit the program and display again the choosing option. ............................ 45
Figure 25 : Selling the laptop. ........................................................................................ 46
Figure 26 : Successfully deduct quantity. ...................................................................... 46
Figure 27 : Showing bill on txt file after selling. ............................................................. 47
Figure 28 : Before add quantity of laptops..................................................................... 48
Figure 29 : Before add quantity of laptop. ..................................................................... 48
Figure 30 : Displaying the txt file after add quantity of laptop. ....................................... 49
Figure 31 : Displaying after adding quantity of XPS. ..................................................... 49

List of Tables
Table 1 : Table for Test 1 .............................................................................................. 38
Table 2 : Table for Test 2 for providing negative value.................................................. 39
Table 3 : Table for Test 2 for providing none existed value. .......................................... 40
Table 4 : Table for Test 3 for showing complete renting process. ................................. 41
Table 5 : Table for Test 4 .............................................................................................. 44
Table 6 : Table for Test 5. ............................................................................................. 45
Table 7 : Table for Test 5.1 ........................................................................................... 47
CS4051NT Fundamentals of Computing

1. Introduction
Python is a powerful, versatile, and widely used programming language. Web
development, machine learning applications, and other advanced industry technology
all employ the Python programming language (latest version is Python 3). Google,
Amazon, Facebook, Instagram, Dropbox, Uber, and many more big tech companies use
the Python programming language.

The largest advantage of Python is very large standard library, which may be utilized for
the following things:

• Machine Learning
• GUI applications, such as PyQt, Kivy, and Tkinter, etc.
• Web frameworks such as Django (used by Dropbox, Instagram, and YouTube)
• Scientific computing

Python is now the most popular high-level, multipurpose programming language that
supports procedural and object-oriented programming. In general, Python applications
are smaller than those written in other languages like Java. As a result of the language's
indentation requirement, programmers must type comparatively less, and their work is
always readable. (Anderson, 2023)

Figure 1 : Logo of Python Programming Language

1
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

Introduction about the project


The aim of this project is to create a software application for a laptop shop that will
effectively manage the process of purchasing laptops from manufacturers and selling
them to both individuals and businesses. The software must be capable of reading and
updating a text file that contains all the necessary details about the available laptops in
stock. It should be able to display the available laptops, update the stock levels after each
sale or purchase, and generate a comprehensive note or receipt for every transaction.
This receipt should include details such as includes the laptop's name, manufacturer,
purchaser's name (if a sale is being made), date and time of purchase, price, shipping
cost (if a sale is being made), and total amount payable The program also has to be able
to create notes for orders that contain the distributor's name (business), the laptop's
name, the brand, the date and time of the purchase, the net amount (without VAT), the
VAT amount (13% of the total price), and the gross amount (including VAT). The text file
used to hold laptop information must include the name of the laptop, the brand, the price,
the number available, CPU information, and graphic card information. It should also be
simple for the software program to update. The overall objective is to provide an effective
and dependable system for the laptop store to handle their sales and inventory.

2. Goals and objectives


Goal
The project's goal is to provide a management solution for laptop shops that can handle
the purchase of laptops from manufacturers and their sale to both consumers and
companies. The program must be able to read and update a text file containing data on
the laptops that are in stock, display laptops that are available for purchase, update
inventory after each purchase or sale, and issue a receipt for each transaction. If a
transaction was made, the receipt must contain information like the name of the laptop,
its brand, the customer's name, the date and time of the purchase, the price, the shipping
costs, and the total amount owed. The application should also create a note for each
order that contains information such as the distributor's (company's) name, the laptop's

2
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

name and brand, the date and time of the transaction, the net amount (without VAT), the
VAT amount (13% of the total price), and the gross amount (including VAT). The text file
must readily allow the software application to update the information about the laptops,
including the name, brand, price, number available, CPU specifications, and graphic card
specifications.

Objectives
The main objective of this project is to create user-friendly software for a laptop store. It
will help manage the process of buying laptops from producers and selling them to
customers, whether they are individuals or businesses. The software will use a text file to
keep track of the laptops available in the store. It can read and update this file, so the
information is always up to date. With the software, store employees can easily see which
laptops are available, and the stock count will automatically adjust after each sale or
purchase.

The software will also generate notes or receipts for every transaction. These documents
will include important details like customer information, laptop model, price, and any
additional notes. By using this software, the laptop store can improve its operations, keep
better track of inventory, and provide a smoother purchasing experience for customers
and employees.

3
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

3. Discussion and Analysis


Algorithm
An algorithm is a process used to finish a calculation or resolve an issue. It provides a
precise set of instructions that carry out certain operations sequentially, regardless of
whether it is utilized for hardware- or software-based activities. Algorithms are frequently
utilized in information technology across many disciplines. In mathematics and computer
science, algorithms are widely employed to quickly address reoccurring issues. They
provide as processing guidelines for data and are crucial to automated systems.
Algorithms may be used to do a wide range of tasks, from simple ones like sorting lists of
numbers to more challenging ones like promoting user content on social networking sites.
They typically start with a predetermined input and instructions that describe a specific
computation. The technique causes an output to be created after the calculation has
finished. Algorithms can be expressed in a variety of forms, such as natural language,
programming languages, pseudocode, flowcharts, and control tables. Since natural
language expressions are usually ambiguous, they are rare, but programming languages
are routinely employed to give techniques that computers can use. (Gillis, 2022)

Algorithm of my program

Step 1: Start

Step 2: Read available laptops from Laptops.txt file

Step 3: Display menu and prompt user for choice

If choice is 1, go to Step 4

If choice is 2, go to Step 6

If choice is 3, go to Step 13

If choice is 4, go to Step 21

4
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

Step 4: Display available laptops.

Step 5: Prompt user to input 0 or 1.

Step 6: Sell laptops.

Step 6.1: Ask customer name.

Step 6.2: Ask laptop number to sell.

Step 6.3: Ask quantity of laptops.

Step 6.4: Check if laptop is available.

If yes, go to Step 11, Step 12, and Step 3

If no, go to Step 3

Step 11: Update Laptops.txt file

Step 12: Create an invoice as a .txt file.

Step 13: Add laptops to stock.

Step 13.1: Display current stock.

Step 13.2: Ask laptop number to add.

Step 13.3: Ask amount of stock to add.

Step 13.4: Ask shipping company name.

Step 13.5: Ask cost of shipping laptops.

Step 13.6: Check if laptop is available in stock.

If yes, go to Step 11, Step 20, Display: "Laptop Name successfully Added
to Stock.", go to Step 3

If no, go to Step 3

5
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

Step 20: Create a unique note for adding laptop as a .txt file.

Step 21: Display farewell message to the customer.

Step 22: End

6
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

Flowchart
A flowchart is a diagram that shows how a system, computer algorithm, or process works.
They are frequently used in many different disciplines to examine, organize, enhance,
and convey frequently complicated processes in simple, understandable diagrams.
Rectangles, ovals, diamonds, and perhaps many more shapes are used in flowcharts,
also known as flow charts, to indicate the kind of step and connecting arrows to indicate
flow and sequence. They can be anything from straightforward hand-drawn charts to
detailed computer-drawn diagrams showing numerous steps and routes. Considering all
the different variations, flowcharts are among the most widely used diagrams on the
world, being utilized by both technical and non-technical persons in a wide range of
industries. Process Flowchart, Process Map, Functional Flowchart, Business Process
Mapping, Business Process Modeling and Notation (BPMN), or Process Flow Diagram
(PFD) are some of the more technical names for flowcharts. They have a connection with
other well-known diagrams like Data Flow Diagrams (DFDs) and UML Activity Diagrams.
(Peterson, 2022)

Figure 2 : Basic Flowchart

7
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

When to use flowchart

1. Document a process.

By creating a flowchart, individuals can map out the steps, sequences, and decisions
involved in the project or process, and gain a better understanding of how it works.
Overall, flowcharts can be a valuable tool for enhancing collaboration and improving
project outcomes.

2. Visualize complex ideas or processes.

Sometimes team members may not have the resources or time to read through a
lengthy and complex process document. To ensure that everyone understands the
workflow, a flowchart can be created that shows the tasks and individual steps in a
simple and easy-to-follow manner. This makes it possible for team members to
analyze the process and gain a clear understanding of it quickly and easily.

3. Assign responsibilities to your team and organize it.


If you represent a process graphically, you could find it easier to assign tasks to team
members and organize your team's work so that everything goes more smoothly.

4. Make and justify decisions.

Making decisions might seem less difficult and complex when they are expressed
graphically in a flowchart. A flowchart can also make it easier to comprehend the
probable results of a choice, which makes it easier to forecast and justify ensuing
actions.

5. Identify and prevent bottlenecks.

Using flowcharts can help you spot possible problems or impediments in a process
early on. It is simpler to follow each phase and make sure that each activity is given
enough time and resources when the entire process is shown. This enables you to
take proactive measures to resolve any bottlenecks or inefficiencies before they
worsen.

8
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

Flowchart of my Program

Figure 3 : Flowchart of my Program

9
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

4. Pseudocode
Pseudocode is a description of an algorithm or computer program written in plain English
that provides an informal, high-level representation of the actual code. Pseudocode is a
useful tool for programmers because it allows them to express their ideas and concepts
without worrying about the syntax of a specific programming language. By using plain
English, programmers can easily communicate their thoughts, even if they work on
different languages. Pseudocode is also easy to read and write, making it a convenient
way to quickly capture and share ideas. The use of pseudocode is a methodology that
helps programmers to present the implementation of an algorithm. Pseudocode provides
a simplified representation of code that can be easily understood by programmers,
regardless of their programming background or knowledge. It is essentially a mock-up or
a rough sketch of code that can be quickly understood by anyone with basic programming
knowledge. This is why algorithms are often represented in pseudocode, as it provides a
straightforward and easy-to-understand way to communicate complex ideas.
(theprogrammedwords, 2023)

Advantages of Pseudocode

▪ Enhances the readability of any strategy. It's one of the most effective ways to
begin implementing an algorithm.
▪ Acts as a connector between the algorithm or flowchart and the program.
Serves as a rudimentary documentation tool and, when put down in
pseudocode, enables understanding of a developer's product.
▪ Pseudocode's primary objective is to precisely describe what each line of a
program should accomplish, making programming easier for the programmer.
▪ Before creating actual code, a program can be planned out in pseudocode,
which helps to structure and organize the development process.

10
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

Pseudocode For Main.py


FUNCTION selectOptions()

TRY

flag = True

WHILE flag

PRINT "___________________Laptop Store_____________________"

PRINT "Press 1 : Display available Laptops"

PRINT "Press 2 : Sell Laptops"

PRINT "Press 3 : Add Laptops"

PRINT "Press 4 : Exit"

PRINT"______________________________________________"

PRINT"______________________________________________"

selectOption = INPUT("Please select number of your choice: ")

IF selectOption is a digit

IF selectOption equals "1"

displayLaptop(readLaptopList())

PRINT "______________________"

PRINT "Press 1: For selling Laptops"

PRINT "Press 0: Exit"

PRINT "______________________"

userInput = INPUT("To proceed, please provide a value: ")

IF userInput equals "1"

Sell.sellLaptops(readLaptopList())

11
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

ELSE IF userInput equals "0"

PRINT "__________________________"

PRINT "Dear, Valued Customer"

PRINT "Thank you for visiting"

PRINT "Please visit again"

PRINT "__________________________"

ELSE

PRINT "Invalid input. Please enter a value between 0 and 1"

END IF

ELSE IF selectOption equals "2"

displayLaptop(readLaptopList())

PRINT "To sell laptop please follow the following instruction"

PRINT"__________________________________________"

Sell.sellLaptops(readLaptopList())

ELSE IF selectOption equals "3"

displayLaptop(readLaptopList())

PRINT "To add laptop please follow the following instruction"

PRINT "____________________________________________"

Add.addLaptopStock(readLaptopList())

ELSE IF selectOption equals "4"

flag = False

PRINT "__________________________"

12
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

PRINT "Dear, Valued Customer"

PRINT "Thank you for visiting"

PRINT "Please visit again"

PRINT "__________________________"

ELSE

PRINT "Error: Invalid option. Please enter a valid choice."

END IF

ELSE

RAISE ValueError("Error: Input must be an integer.")

END IF

END WHILE

EXCEPT ValueError as e

PRINT e

END TRY

selectOptions()

END FUNCTION

13
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

Pseudocode code for Read.py

FUNCTION readLaptopList()

laptopsList = []

file = OPEN("laptops.txt", "r")

lines = file.READLINES()

FOR line in lines

a = SPLIT(STRIP(line), ",")

laptopsList.APPEND(a)

file.CLOSE()

RETURN laptopsList

END FUNCTION

FUNCTION displayLaptop(laptopsList)

FOR i in range(length of laptopsList)

laptop = laptopsList[i]

laptop.INSERT(0, i + 1)

headers = [

"S.No.",

"Name",

"Company",

"Price",
14
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

"Quantity",

"Generation",

"Graphics Card",

table = COPY(laptopsList)

table.INSERT(0, headers)

PRINT "\n\n << __________:: List of Available Laptops :: ________>>\n "

PRINT tabulate(table, headers="firstrow", tablefmt="grid")

END FUNCTION

15
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

PseudoCode For Sell.py

FUNCTION sellLaptops(laptopsList)

name = INPUT("Enter Customer Name:")

TRY

number = CAST(INPUT("Enter Laptops SN Number:") to INTEGER)

IF number is less than 1 OR number is greater than length of laptopsList

PRINT "Invalid laptop SN number. Please try again."

PRINT "__________________________________________"

RETURN

quantity = CAST(INPUT("Enter Quantity:") to INTEGER)

FOR i in range(length of laptopsList)

laptop = laptopsList[i]

IF i + 1 equals number

stock = CAST(laptop[3] to INTEGER)

IF quantity is greater than stock

PRINT "Insufficient Quantity!!"

PRINT "Available quantity in store:", stock

RETURN

ELSE IF quantity is less than or equal to 0

PRINT "Please enter valid number !"

RETURN
16
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

laptop[3] = stock - quantity

updateStock(laptopsList)

invoice(number, name, laptopsList, quantity)

PRINT "Congratulations! The " + laptop[1] + " laptop is now in the hands of " +
name + "."

PRINT " __________Your invoice is ready for review__________ "

PRINT "__________please take a moment to check it over____________"


PRINT"__________________________________________________"

RETURN

PRINT "__________________________________________________"

PRINT "We apologize, but the laptop you are seeking is not currently available."

EXCEPT ValueError

PRINT "Integer Value should be entered for Laptops numbers and Quantity"

END TRY

END FUNCTION

FUNCTION updateStock(laptopsList)

WITH OPEN("Laptops.txt", "w") AS update

FOR i in range(length of laptopsList)

FOR j in range(6)

IF j equals 5

update.WRITE(str(laptopsList[i][j]) + "\n")

17
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

ELSE

update.WRITE(str(laptopsList[i][j]) + ",")

CLOSE update

END FUNCTION

Pseudocode For Invoice.py

FUNCTION invoice(userNumber, customerName, laptopsList, quantity)

selected_laptop = laptopsList[userNumber-1]

Name = selected_laptop[0]

company = selected_laptop[1]

price = selected_laptop[2]

gen = selected_laptop[4]

graphicsCard = selected_laptop[5]

total_price = CONVERT(price.strip('$')) * quantity

IF NOT EXISTS(customerName + ".txt")

f = OPEN(customerName + ".txt", "w")

f.WRITE("______________________________________________________\n")

f.WRITE(" Date: {}/{}/{}\n".FORMAT(CURRENT_YEAR, CURRENT_MONTH,


CURRENT_DAY))

f.WRITE(" PAN No. 90393923\n")

18
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

f.WRITE(" ______________ Laptop store ______________ \n")

f.WRITE(" ______________ Ithari,Nepal ______________ \n")

f.WRITE(" Contact No.: 9840471599\n")

f.WRITE(" ________________________\n")

f.WRITE("_____________________________________________________\n")

f.WRITE("Customer's Name: {}\n".FORMAT(customerName))

f.WRITE("Name: {}\n".FORMAT(Name))

f.WRITE("Company: {}\n".FORMAT(company))

f.WRITE("Quantity: {}\n".FORMAT(quantity))

f.WRITE("Price: {}\n".FORMAT(price))

f.WRITE("Generation: {}\n".FORMAT(gen))

f.WRITE("Graphics Card: {}\n".FORMAT(graphicsCard))

f.WRITE("___________________________\n")

f.WRITE("Your total price is: ${}\n".FORMAT(total_price))

f.WRITE("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n")

f.WRITE(" _________Dear Valued Customer________\n")

f.WRITE(" _________Kindly check your Invoice________\n")

f.WRITE(" _______Thank you for your visit______\n")

f.WRITE("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n")

PRINT "_____________________________________________________"

PRINT "Invoice has been created successfully!"

PRINT "______________________________________"

19
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

f.CLOSE()

ELSE

f = OPEN(customerName + ".txt", "a")

f.WRITE("_____________________________________________________\n")

f.WRITE("Date: {}/{}/{}\n".FORMAT(CURRENT_YEAR, CURRENT_MONTH,


CURRENT_DAY))

f.WRITE(" PAN No. 90393923\n")

f.WRITE(" Laptop store \n")

f.WRITE(" Ithari,Nepal \n")

f.WRITE(" Contact No.: 9840471599\n")

f.WRITE("______________________________________________________ \n")

f.WRITE("Customer's Name: {}\n".FORMAT(customerName))

f.WRITE("Name: {}\n".FORMAT(Name))

f.WRITE("Company: {}\n".FORMAT(company))

f.WRITE("Quantity: {}\n".FORMAT(quantity))

f.WRITE("Price: {}\n".FORMAT(price))

f.WRITE("Generation: {}\n".FORMAT(gen))

f.WRITE("Graphics Card: {}\n".FORMAT(graphicsCard))

f.WRITE("____________________\n")

f.WRITE("Your total price is: ${}\n".FORMAT(total_price))

f.WRITE("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - “)

print("_____________________________________________________")

print("Invoice has been created successfully!")

20
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

print("______________________________________")

f.close()

Pseudocode For Add.py

FUNCTION addLaptopStock(laptopList)

laptopNumber = CAST(INPUT("Enter SN number of laptops: ") to INTEGER)

IF laptopNumber is less than 1 OR laptopNumber is greater than length of laptopList

PRINT "Invalid laptop SN number. Please try again."

PRINT "__________________________________________"

RETURN

laptopStock = CAST(INPUT("Enter the quantity you want to add: ") to INTEGER)

shippingCompany = INPUT("Enter shipping company: ")

shippingCost = CAST(INPUT("Enter total cost of shipping: ") to INTEGER)

FOR i in range(length of laptopList)

IF (i + 1) equals laptopNumber

a = CAST(laptopList[i][3] to INTEGER)

a += laptopStock

laptopList[i][3] = a

Sell.updateStock(laptopList)

addLaptopStockDetails(laptopList, laptopNumber, laptopStock,


shippingCompany, shippingCost)

21
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

PRINT "_______________________________________"

PRINT laptopList[i][0] + " is added Successfully"

PRINT "Please check your Laptops.txt file"

PRINT "Display the list of laptops to see the newly added quantity"

PRINT"_________________________________________________________"

END FOR

END FUNCTION

FUNCTION addLaptopStockDetails(laptopList, laptopNumber, StockAmount,


laptopShippingCompany, laptopShipppingCost)

k = GET CURRENT DATETIME

FOR i in range(length of laptopList)

IF (i + 1) equals laptopNumber

Name = laptopList[i][0]

company = laptopList[i][1]

price = laptopList[i][2]

quantity = laptopList[i][3]

gen = laptopList[i][4]

graphicsCard = laptopList[i][5]

f = "Add" + Name + ".txt"

f = OPEN f for WRITE

f.WRITE("\n" + "\t\t_______________________________________")

22
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

f.WRITE("\n" + "\t\t______________Laptop Added ___________")

f.WRITE("\n""\t\t_____________________________________________")

f.WRITE("\n" + "\t\t Laptop Name : " + Name)

f.WRITE("\n" + "\t\t Laptop company : " + company)

f.WRITE("\n" + "\t\t Laptop Price : " + price)

f.WRITE("\n" + "\t\t Laptop Quantity : " + STR(quantity))

f.WRITE("\n" + "\t\t Generation : " + gen)

f.WRITE("\n" + "\t\t Graphics Card : " + graphicsCard)

f.WRITE("\n" + "\t\t Stock added : " + STR(StockAmount))

f.WRITE("\n" + "\t\t Shipping Company : " +


laptopShippingCompany)

f.WRITE("\n" + "\t\t Shipping Cost : $" +


STR(laptopShipppingCost))

f.WRITE("\n" + "\t\t Delivery Date : " + STR(k.year) + " - " +


STR(k.month) + " - " + STR(k.day))

f.WRITE("\n" + "\t\t Delivery Time : " + STR(k.hour) + " : " +


STR(k.minute))

f.WRITE("\n" + "\t\t________________________________________")

f.WRITE("\n" + "\t\t _______________________________________")

f.WRITE("\n""\t\t_______________________________________")

f.CLOSE

END FUNCTION

23
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

5. Data Structures
A storage that is used to store and arrange data is called a data structure. It is a method
of setting up data on a computer to make it easily accessible and up to date. A data
structure is used for more than just data organization. Additionally, it is employed for data
processing, retrieval, and archiving. Nearly all existing software systems and programs
make use of a variety of simple and sophisticated data structure types. Therefore, we
need to be well-versed in data structures. (Preston, 2023)

Data structures may be divided into two groups: both primitive and nonprimitive data
types. These are described below.

Primitive data types

i. Integer

A number without a decimal or fractional element is known as an integer, which


encompasses both positive and negative numbers, including zero. Integers can
take the following forms: -5, 0, 1, 5, 8, 97, and 3,043.

Figure 4 : In my program, integer is used.

24
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

ii. Float

A sort of numerical data known as a float (short for "floating-point number")


represents real numbers with a fractional component. Non-whole numbers,
such as 3.14 or 0.001, are represented using floating point numbers, or floats.
As the standard data type for real numbers in programming, float is frequently
used.

Figure 5 : Float also used in my program.

iii. Boolean
A result that can only be true or false is referred to as a boolean result. Boolean
logic creates a value that can be either true or false by combining two
statements or expressions with a logical operator.

25
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

Figure 6 : In my program Boolean is used.

26
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

Non- Primitive data types

i. List

A list is a built-in data structure used to hold a group of objects. A list is


denoted by square brackets [], and commas are used to separate each item.
Any data type, including numbers, strings, Boolean values, and even other
lists, can be included in a list.

Figure 7 : In my program List is used.

In my program, I utilized a list as well. The reason behind this choice is that a
list allows me to store various data types, granting flexibility in handling
different kinds of information. Moreover, by using index numbers, I can easily
retrieve any specific data from the list. Another advantage of using a list is its
mutability, enabling me to modify or substitute values as needed. Given that
my program primarily focuses on updating values, the utilization of a list
proves to be highly beneficial.

27
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

ii. Tuple

An ordered and immutable group of elements is referred to as a tuple.


Parentheses () are used to denote tuples, while commas are used to divide
the elements.

Figure 8 : Example of Tuple.

iii. Set

A set is a collection of items that does not have a specific order and only
contains unique elements. This implies that duplicate elements are not
allowed in a set. Therefore, a set is a useful data structure to store unique
items and perform operations such as intersection, union, and difference
between sets.

Figure 9 : Example of Set.

28
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

iv. Dictionary

An unordered collection of key-value pairs with a requirement that each key


be distinct is known as a dictionary (or dict). Any hashable type, such as
strings, integers, or tuples, can be the keys in a dictionary. Any type of object,
including other dictionaries, lists, or Python objects, may be used as the
values.

Figure 10 : Example of Dictionary.

29
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

6. Program

Overall program with short explanation

Figure 11 : Modules of my Program.

Five modules make up my program they are briefly described here.

i. Main.py

This module is the main part of my program and it starts the program. It uses three other
modules called Sell.py, Read.py, and Add.py to do different tasks. There is a function in
this module called selectOptions() which shows the user four options and asks them to
select number of your choice: If the user selects option 1, they can see the details of
available laptops. Option 2 allows the user to sell a laptop to a customer. Option 3 lets
the user add laptops to the stock, and option 4 is used to exit the program.

ii. Sell
This module includes the sellLaptops() function that prompts the user to input the
customer's name, the laptop number, and the quantity to be purchased. Then checks if
the entered laptop number is available in the stock. If it is available, the selected laptop's
quantity in the stock is reduced by the amount purchased by the customer. An invoice is
generated in the customer's name, containing all the laptop details, and a message
indicating that the purchase was successful is displayed.

30
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

Furthermore, this module contains another function called updateStock(). sellLaptops()


invokes this function, which opens the Laptops.txt file in write mode and replaces the old
quantity with the newly updated quantity after a successful sale of the laptop. Additionally,
the Invoice.py module is imported into this module.

iii. Read
The code imports the tabulate module which is used to create tables in the console from
a list. The function readLaptopList() reads the data from a file named "laptops.txt" and
returns a list of laptops. The file should have the laptop details in a specific format: each
line should contain the details of one laptop separated by a comma and a space. The
order of details should be: name, company, price, quantity, generation, graphics card.
The function opens the file in read mode, reads all the lines, strips the whitespace
characters and splits the line using the comma and space separator. Then, it appends
the details of the laptop as a list to the laptopsList list. Finally, it returns the laptopsList
list.

iv. Add
This code defines two functions: addLaptopStock() and addLaptopStockDetails(). The
addLaptopStock() function prompts the user to enter the number and quantity of laptops
to be added to the stock, along with the shipping company and cost. It then updates the
quantity of the specified laptop in the stock and calls the addLaptopStockDetails() function
to create a text file with the details of the added laptops, including the shipping
information. The function Sell.updateStock() is also called to update the stock details in
the Laptops.txt file. The addLaptopStockDetails() function creates a text file with the
details of the added laptop, including its name, company, price, quantity, generation,
graphics card, and shipping details. To obtain the current date and time for the delivery
date and time in the file, it makes use of the datetime module.

31
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

v. Invoice
This module imports two built-in modules, datetime and os. It defines a parameterized
function named invoice() that is called from the sellLaptops() function of the sellLaptops
module. The invoice() function checks if the laptop number entered by the user exists in
the stock. If it does, the function generates an invoice with the customer's name, purchase
date, and other laptop details. It also checks if an invoice file with the given customer
name exists in the directory. If it does not exist, it creates a new text file with the customer
name. If it exists, it appends the laptop details to the previous text file.

32
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

Show the selling and adding laptop complete process.


This is my add program when I am increasing the quantity of laptops in my store.

Figure 12 : Complete process of Add Quantity.

33
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

This is my sale program when I am selling laptops from my store.

Figure 13 : Complete process of Selling Laptops.

34
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

Creation of txt file


This is my program, which creates a text file after each sale transaction.

35
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

Figure 14 : Complete process of making txt file.

Opening txt and show the bill.

Figure 15 : Generate Text file after selling laptop.

36
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

Showing the termination of program


This is my program for at the end that user want to exit the program.

Figure 16 : Exit part of my program.

37
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

7. Testing
Test 1
Objective To check the implementation of try except
Action String input was given in the choice which
inputs integer value
Excepted Result It should display the valueError message
Actual Result It displayed the valueError message
Conclusion Test successful.

Table 1 : Table for Test 1

Figure 17 : Giving String input where inputs integer value.

38
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

Test 2:
Provide negative value as input.

Objective To provide negative value as input.


Action Negative input was given in the quantity
while adding laptop
Excepted Result It should display the error message while
adding negative value in quantity
Actual Result It display the error message while adding
negative value in quantity
Conclusion Test successful.

Table 2 : Table for Test 2 for providing negative value

Figure 18 : Provide negative value in quantity.

39
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

Provide none existed value as input.

Objective To provide non existed value as input


Action Non existed input was given in the
quantity while adding laptop
Excepted Result It should display the error message while
input non existed value in quantity
Actual Result It display the error message while input
non existed value in quantity
Conclusion Test successful.

Table 3 : Table for Test 2 for providing none existed value.

Figure 19 : Provide none existed value in quantity.

40
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

Test 3
Show complete selling process.

Objective To show complete selling process.


Action Showing complete process of selling.
Excepted Result It should display the successful message
and make invoice after sell.
Actual Result It display the successful message and
make invoice after sell.
Conclusion Test successful.

Table 4 : Table for Test 3 for showing complete renting process.

Figure 20 : Step 1st before selling the laptop.

41
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

Show output in the shell as well.

Figure 21 : Show selling output in shell.

42
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

Finally show the selling note in txt file

Figure 22 : Show the renting in txt file.

43
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

Test 4
Objective Following every operation, to find out if
the program is in a loop or not.
Action The program is used to purchase a
laptop.
Excepted Result It should display the choosing options
again.
Actual Result It displayed the choosing options again.
Conclusion Test successful.

Table 5 : Table for Test 4

Figure 23 : Display option before display laptop.

44
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

Figure 24 : Exit the program and display again the choosing option.

Test 5
Showing the quantity being deduct while selling.

Objective To show the quantity being deduct while


selling.
Action The program is used to deduct the
quantity in the stock.
Excepted Result It should deduct the quantity of laptop in
the stock
Actual Result It deduct quantity of laptop in the store.
Conclusion Test successful.

Table 6 : Table for Test 5.

45
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

Figure 25 : Selling the laptop.

Figure 26 : Successfully deduct quantity.

46
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

Figure 27 : Showing bill on txt file after selling.

Showing the quantity added.

Objective To add laptop quantity in store


Action The program is used to add quantity in
the stock.
Excepted Result It should add the quantity of laptop in the
stock
Actual Result It adds quantity of laptop in the store
Conclusion Test successful.
Table 7 : Table for Test 5.1

47
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

Figure 28 : Before add quantity of laptops.

Figure 29 : Before add quantity of laptop.

48
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

Figure 30 : Displaying the txt file after add quantity of laptop.

Display after Adding quantity on XPS

Figure 31 : Displaying after adding quantity of XPS.

49
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

8. Conclusion

The first coursework in the Fundamental of Computing module was quite challenging. We
had to create a Python program for a laptop rental shop. The program needed to read
and update information stored in a text file. It was tough, but with hard work and
commitment, I managed to complete the task.

To make the program work smoothly, I had to use different tools and techniques. I learned
how to use functions, conditions, and various data structures like lists and dictionaries. I
also had to handle files and import modules to make everything work together. In the end,
the program was able to show available laptops, update the stock, generate invoices, and
keep track of transactions by modifying the text file. During the project, I faced many
challenges that required me to do a lot of research. I had to browse different websites to
find solutions and learn more about Python programming. Thanks to the support and
guidance from my module teachers, I was able to overcome these difficulties and finish
the task on time. The coursework taught me a lot about Python programming. I learned
how to use functions, conditions, and different types of data like strings, numbers, lists,
and True/False statements. I also learned how to create and modify text files using Python
and how to import and use modules.

Overall, this project was a great learning experience. It helped me improve my research
skills, time management, and ability to stay calm in difficult situations

50
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

9. Appendix

Code for Main.py

from Read import readLaptopList, displayLaptop

import Add

import Sell

def selectOptions():

try:

flag = True

while flag:

print("""

____________________________________________________

____________Laptop Store____________

____________________________________________________

Press 1 : Display available Laptops

Press 2 : Sell Laptops

Press 3 : Add Laptops

Press 4 : Exit

51
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

____________________________________________________

____________________________________________________

""")

selectOption = input("Please select number of your choice: ")

if selectOption.isdigit():

if selectOption == "1":

displayLaptop(readLaptopList())

print("""

__________________________________________

Press 1: For selling Laptops

________ Press 0: Exit ________

""")

userInput = input("\nTo proceed, please provide a value: ")

if userInput == "1":

Sell.sellLaptops(readLaptopList())

elif userInput == "0":

print("""

__________Dear, Valued Customer__________

_____________Thank you for visiting____________

__________Please visit again__________

52
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

""")

else:

print("Invalid input. Please enter a value between 0 and 1")

elif selectOption == "2":

displayLaptop(readLaptopList())

print("\nTo sell laptop please follow the following instruction")

print("______________________________________________________\n")

Sell.sellLaptops(readLaptopList())

elif selectOption == "3":

displayLaptop(readLaptopList())

print("\nTo add laptop please follow the following instruction")

print("_____________________________________________________\n")

Add.addLaptopStock(readLaptopList())

elif selectOption == "4":

flag = False

print("""

__________Dear, Valued Customer__________

_____________Thank you for visiting____________

__________Please visit again__________

""")

else:

53
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

print("Error: Invalid option. Please enter a valid choice.")

else:

raise ValueError("Error: Input must be an integer.")

except ValueError as e:

print(e)

selectOptions()

Code for Read.py

from tabulate import tabulate

def readLaptopList():

laptopsList = []

file = open("laptops.txt", "r")

lines = file.readlines()

for line in lines:

a = line.strip().split(",")

laptopsList.append(a)

file.close()

54
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

return laptopsList

def displayLaptop(laptopsList):

# Adding S.No. to the laptops

for i in range(len(laptopsList)):

laptop = laptopsList[i]

laptop.insert(0, i + 1)

headers = [

"S.No.",

"Name",

"Company",

"Price",

"Quantity",

"Generation",

"Graphics Card",

table = laptopsList.copy()

table.insert(0, headers)

print(

55
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

"""\n\n << ______________ :: List of Available Laptops ::


______________ >>\n """

print(tabulate(table, headers="firstrow", tablefmt="grid"))

Code for Sell.py

from Invoice import invoice

def sellLaptops(laptopsList):

name = input("Enter Customer Name:")

try:

number = int(input("Enter Laptops SN Number:"))

if number < 1 or number > len(laptopsList):

print("Invalid laptop SN number. Please try again.")

print("__________________________________________\n")

return

quantity = int(input("Enter Quantity:"))

56
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

for i, laptop in enumerate(laptopsList):

if i + 1 == number: # Compare serial numbers

stock = int(laptop[3])

if quantity > stock:

print("\nInsufficient Quantity!!")

print("Available quantity in store:", stock)

return

elif quantity <= 0:

print("\nPlease enter valid number !")

return

laptopsList[i][3] = str(stock - quantity) # Update stock

updateStock(laptopsList)

invoice(number, name, laptopsList, quantity)

print("\tCongratulations! The " +

laptop[1] + " laptop is now in the hands of " + name+".")

print("\t __________Your invoice is ready for review__________ ")

print("\t__________please take a moment to check it over____________")

57
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

print("\t____________________________________________________________")

return

print("_________________________________________________________________
______")

print(

"We apologize, but the laptop you are seeking is not currently available."

except ValueError:

print("Integer Value should be entered for Laptops numbers and Quantity")

def updateStock(laptopsList):

with open("Laptops.txt", "w") as update:

for i in range(len(laptopsList)):

for j in range(6):

if j == 5:

update.write(str(laptopsList[i][j]) + "\n")

else:

update.write(str(laptopsList[i][j]) + ",")

update.close()

58
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

Code for Add.py

import datetime

import Sell

def addLaptopStock(laptopList):

laptopNumber = int(input("Enter SN number of laptops: "))

if laptopNumber < 1 or laptopNumber > len(laptopList):

print("Invalid laptop SN number. Please try again.")

print("__________________________________________\n")

return

laptopStock = int(input("Enter the quantity you want to add: "))

if laptopStock <= 0:

print("\nPlease enter valid number !")

return

shippingCompany = input("Enter shipping company: ")

shippingCost = int(input("Enter total cost of shipping: "))

59
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

for i in range(len(laptopList)):

if (i+1 == laptopNumber):

a = int(laptopList[i][3])

a += laptopStock

laptopList[i][3] = a

Sell.updateStock(laptopList)

addLaptopStockDetails(laptopList, laptopNumber, laptopStock,


shippingCompany, shippingCost)

print("_______________________________________\n")

print(laptopList[i][0]+" is added Successfully")

print("Please check your Laptops.txt file")

print("Display the list of laptops to see the newly added quantity")

print("_______________________________________________________
__")

def addLaptopStockDetails(laptopList, laptopNumber, StockAmount,


laptopShippingCompany, laptopShippingCost):

k = datetime.datetime.now()

for i in range(len(laptopList)):

60
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

if (i+1 == laptopNumber):

Name = laptopList[i][0]

company = laptopList[i][1]

# float() function used in the calculation cannot handle non-numeric


characters like the dollar sign.

price = laptopList[i][2].replace('$', '')

quantity = laptopList[i][3]

gen = laptopList[i][4]

graphicsCard = laptopList[i][5]

vat = float(price) * (13/100)

totalAmountWithVat = float(price) + vat

f = "Add" + Name + ".txt"

f = open(f, "w")

f.write("\n"+"\t\t________________________________________________
__________________________")

f.write("\n"+"\t\t___________________________ Laptop Added


_____________________________")

61
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

f.write("\n"+"\t\t________________________________________________
__________________________")

f.write("\n"+"\t\t Laptop Name : "+Name)

f.write("\n"+"\t\t Laptop company : "+company)

f.write("\n"+"\t\t Laptop Price : $"+price)

f.write("\n"+"\t\t Laptop Quantity : "+str(quantity))

f.write("\n"+"\t\t Generation : "+gen)

f.write("\n"+"\t\t Graphics Card : "+graphicsCard)

f.write("\n"+"\t\t Stock added : "+str(StockAmount))

f.write("\n"+"\t\t Shipping Company : " +

laptopShippingCompany)

f.write("\n"+"\t\t Shipping Cost : $" +

str(laptopShippingCost))

f.write("\n"+"\t\t Delivery Date :"+

str(k.year)+" - "+str(k.month)+" - "+str(k.day))

f.write("\n"+"\t\t Delivery Time :"+

str(k.hour)+" : "+str(k.minute))

f.write("\n"+"\t\t Total Cost (incl. 13% VAT): $ : " +

str(totalAmountWithVat))

62
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

f.write("\n"+"\t\t________________________________________________
__________________________")

f.write("\n"+"\t\t
__________________________________________________ ")

f.write("\n"+"\t\t________________________________________________
__________________________")

f.close()

Code for Invoice.py

import datetime

import os.path

def invoice(laptopNumber, customerName, laptopsList, quantity):

# get the laptop data for the selected laptopNumber

selected_laptop = laptopsList[laptopNumber-1]

Name = selected_laptop[0]

company = selected_laptop[1]

63
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

price = selected_laptop[2]

gen = selected_laptop[4]

graphicsCard = selected_laptop[5]

total_price = int(price.strip('$')) * quantity

if not os.path.exists(customerName + ".txt"):

f = open(customerName + ".txt", "w")

f.write("______________________________________________________
___________\n")

f.write(" Date: {} / {} /
{}\n".format(datetime.datetime.now().year,

datetime.datetime.now().month,

datetime.datetime.now().day))

f.write(" PAN No. 90393923\n")

64
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

f.write(" ______________ Laptop store ______________


\n")

f.write(" ______________ Ithari,Nepal ______________ \n")

f.write(" Contact No.: 9840471599\n")

f.write(" ________________________\n")

f.write("______________________________________________________
___________\n")

f.write("Customer's Name: {}\n".format(customerName))

f.write("Name: {}\n".format(Name))

f.write("Company: {}\n".format(company))

f.write("Quantity: {}\n".format(quantity))

f.write("Price: {}\n".format(price))

f.write("Generation: {}\n".format(gen))

f.write("Graphics Card: {}\n".format(graphicsCard))

f.write("___________________________\n")

f.write("Your total price is: ${}\n".format(total_price))

f.write("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n")

f.write(" _________Dear Valued Customer________\n")

f.write(" _________Kindly check your Invoice________\n")

65
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

f.write(" _______Thank you for your visit______\n")

f.write("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n")

f.close()

print("_______________________________________________________
_______________________")

print("Invoice has been created successfully!")

print("______________________________________")

else:

f = open(customerName + ".txt", "a")

f.write("______________________________________________________
___________\n")

f.write("Date: {} / {} / {}\n".format(datetime.datetime.now().year,

datetime.datetime.now().month,

datetime.datetime.now().day))

f.write(" PAN No. 90393923\n")

f.write(" Laptop store \n")

f.write(" Ithari,Nepal \n")

66
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

f.write(" Contact No.: 9840471599\n")

f.write(

"___________________________________________________________
________ \n")

f.write("Customer's Name: {}\n".format(customerName))

f.write("Name: {}\n".format(Name))

f.write("Company: {}\n".format(company))

f.write("Quantity: {}\n".format(quantity))

f.write("Price: {}\n".format(price))

f.write("Generation: {}\n".format(gen))

f.write("Graphics Card: {}\n".format(graphicsCard))

f.write("____________________\n")

f.write("Your total price is: ${}\n".format(total_price))

f.write("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n")

f.write(" _________Dear Valued Customer________\n")

f.write(" _________Kindly check your Invoice________\n")

f.write(" _______Please Visit Again______\n")

f.write("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n")

67
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

print("_______________________________________________________
_______________________")

print("Invoice has been created successfully!")

print("______________________________________")

f.close()

68
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

10. References
Anderson, 2023. JavaPoint. [Online]
Available at: https://www.javatpoint.com/python-tutorial
[Accessed 11 November 2023].

Asana, T., 2023. asana. [Online]


Available at: https://asana.com/resources/what-is-a-flowchart
[Accessed 1 May 2023].

Gillis, A. S., 2022. Tech Target. [Online]


Available at: https://www.techtarget.com/whatis/definition/algorithm
[Accessed 1 May 2023].

Peterson, J., 2022. Lucid Chart. [Online]


Available at: https://www.lucidchart.com/pages/what-is-a-flowchart-tutorial
[Accessed 3 May 2023].

Preston, J., 2023. GeeksForGeeks. [Online]


Available at: https://www.geeksforgeeks.org/data-structures/
[Accessed 1 May 2023].

theprogrammedwords, 2023. GeeksForgeeks. [Online]


Available at: https://www.geeksforgeeks.org/how-to-write-a-pseudo-code/
[Accessed 1 May 2023].

69
Arpan Karki 22072096
CS4051NT Fundamentals of Computing

11. Report

70
Arpan Karki 22072096

You might also like