<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: FBTO45</title>
    <description>The latest articles on DEV Community by FBTO45 (@fbto45).</description>
    <link>https://dev.to/fbto45</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1391067%2F948bb40a-d087-4833-968f-75542f497b8a.jpeg</url>
      <title>DEV Community: FBTO45</title>
      <link>https://dev.to/fbto45</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/fbto45"/>
    <language>en</language>
    <item>
      <title>Project_Python_Pacmann-Super_Cashier</title>
      <dc:creator>FBTO45</dc:creator>
      <pubDate>Mon, 29 Apr 2024 03:13:55 +0000</pubDate>
      <link>https://dev.to/fbto45/projectpythonpacmann-supercashier-2k40</link>
      <guid>https://dev.to/fbto45/projectpythonpacmann-supercashier-2k40</guid>
      <description>&lt;h1&gt;
  
  
  &lt;strong&gt;Hi there 👋 , I'm Goo!&lt;/strong&gt;
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Background Problems
&lt;/h2&gt;

&lt;p&gt;A supermarket owner named Andi has plans to improve his business by creating a self-service cashier system. The system allows customers to input the items purchased, the number of items, the price of the items, and other features. So, Andi needs a programmer to create the cashier system.&lt;/p&gt;

&lt;h2&gt;
  
  
  Objectives
&lt;/h2&gt;

&lt;p&gt;This project aims to create a self-service cashier system with the following flow :&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The customers create a customer transaction ID.&lt;/li&gt;
&lt;li&gt;Customers input the name of the item, quantity of items, and price of the item purchased.&lt;/li&gt;
&lt;li&gt;If it turns out there was an error in entering the item name, item quantity, or item price, the customer can change or update the item :

&lt;ul&gt;
&lt;li&gt;update the item name&lt;/li&gt;
&lt;li&gt;update the number of items&lt;/li&gt;
&lt;li&gt;update the item price&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;If the customers cancel to purchase an item, customers can delete the item:

&lt;ul&gt;
&lt;li&gt;delete 1 item&lt;/li&gt;
&lt;li&gt;reset all transactions&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;If the customers have finished purchasing, but are still unsure whether the price of the goods and name entered are correct, the customers can check the order with the following output:

&lt;ul&gt;
&lt;li&gt;Issue the message "Order is correct" if there are no input errors.&lt;/li&gt;
&lt;li&gt;Issue the message "There is a data input error" if an input error occurs.&lt;/li&gt;
&lt;li&gt;Displays a table containing all order data.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Finally, customers can display the total price or total purchase to be paid and the discount obtained (if any).&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Flowchart
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk0gr5913tcr5w4pkd7pf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk0gr5913tcr5w4pkd7pf.png" alt="Image description" width="800" height="1003"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Explanation of Attributes and Methods
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt; The &lt;code&gt;items&lt;/code&gt; attribute has a &lt;code&gt;list type,&lt;/code&gt; used to store all items in the transaction.&lt;/li&gt;
&lt;li&gt; The &lt;code&gt;total_price&lt;/code&gt; attribute has the &lt;code&gt;float type,&lt;/code&gt; used to store the total price of an item after discounts.&lt;/li&gt;
&lt;li&gt; The &lt;code&gt;discount&lt;/code&gt; attribute has the &lt;code&gt;float type,&lt;/code&gt; used to store the total amount of discount obtained.&lt;/li&gt;
&lt;li&gt; The &lt;code&gt;self.items&lt;/code&gt; attribute is a reference to the items attribute in the instance (object) created.&lt;/li&gt;
&lt;li&gt; The &lt;code&gt;self.total_price&lt;/code&gt; attribute is a reference to the &lt;code&gt;total_price&lt;/code&gt; attribute in the instance (object) created.&lt;/li&gt;
&lt;li&gt; The &lt;code&gt;self.discount&lt;/code&gt; attribute is a reference to the discount attribute in the instance (object) created.&lt;/li&gt;
&lt;li&gt; Method &lt;code&gt;add_item(self, item)&lt;/code&gt; to &lt;code&gt;add items&lt;/code&gt; to the transaction into a list of items containing three elements, including: &lt;code&gt;item name [0], number of items [1], and price per item [2]&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt; The &lt;code&gt;update_item_name(self, item_name, new_item)&lt;/code&gt; method is used to update the item name. It has two parameters, &lt;code&gt;item_name&lt;/code&gt; is the name of a previously existing &lt;code&gt;item,&lt;/code&gt; and &lt;code&gt;new_item&lt;/code&gt; is the name of the &lt;code&gt;new item&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt; The &lt;code&gt;update_item_quantity(self, item_name, new_quantity)&lt;/code&gt; method is used to update the number of &lt;code&gt;items&lt;/code&gt;. It has two parameters, item_name is the name of the item whose quantity you want to update, and new_quantity is the number of new items.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;update_item_price(self, item_name, new_price)&lt;/code&gt; method is used to update the item price. It has two parameters, &lt;code&gt;item_name&lt;/code&gt; is the name of the item whose price you want to update, and new_price is the price of the new item.&lt;/li&gt;
&lt;li&gt;Method &lt;code&gt;delete_item(self, item_name)&lt;/code&gt; to delete items from the transaction. The &lt;code&gt;item_name&lt;/code&gt; parameter is the name of the item you want to delete.&lt;/li&gt;
&lt;li&gt;Method &lt;code&gt;reset_transaction(self)&lt;/code&gt; to empty or delete all items from the shopping cart. &lt;/li&gt;
&lt;li&gt;Method &lt;code&gt;check_order(self)&lt;/code&gt; is a method to display all orders that have been made in table form containing &lt;code&gt;item number, item name, number of items, price per item, and total price&lt;/code&gt; (multiplication of number of items and price per item).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Calculate_total_price(self)&lt;/code&gt; is a method to calculate the total price and discount obtained from all items that have been added to the items list. This method processes a 10% discount if the total purchase is more than IDR 500,000.00, 8% if the total purchase is more than IDR 300,000.00, or 5% if the total purchase is more than IDR 200,000.00.&lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  Test Case
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Test Case 1
&lt;/h2&gt;

&lt;p&gt;Add 2 items using the &lt;code&gt;add_item&lt;/code&gt; method.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The input is:&lt;/strong&gt;&lt;br&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Test Case 1
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;print("Test Case 1")&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;trnsct_123.add_item(["Ayam Goreng", 2, 20000])&lt;/code&gt;&lt;br&gt;
&lt;code&gt;trnsct_123.add_item(["Pasta Gigi", 3, 15000])&lt;/code&gt;&lt;br&gt;
&lt;code&gt;print("Item yang dibeli adalah: ", trnsct_123.items)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The output is:&lt;/strong&gt;&lt;br&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6mnxbklw0ek7p1j9fjsn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6mnxbklw0ek7p1j9fjsn.png" alt="Image description" width="759" height="112"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Test Case 2
&lt;/h2&gt;

&lt;p&gt;Deletes items using the &lt;code&gt;delete_item&lt;/code&gt; method.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The input is:&lt;/strong&gt;&lt;br&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Test Case 2
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;print("Test Case 2")&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;trnsct_123.delete_item("Pasta Gigi")&lt;/code&gt;&lt;br&gt;
&lt;code&gt;print("Item yang dibeli adalah: ", trnsct_123.items)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The output is:&lt;/strong&gt;&lt;br&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffv7d8gbtenqu0j1g0hmw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffv7d8gbtenqu0j1g0hmw.png" alt="Image description" width="577" height="85"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Test Case 3
&lt;/h2&gt;

&lt;p&gt;Deletes all items using the &lt;code&gt;reset_transaction&lt;/code&gt; method.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The input is:&lt;/strong&gt;&lt;br&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Test Case 3
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;print("Test Case 3")&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;trnsct_123.reset_transaction()&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The output is:&lt;/strong&gt;&lt;br&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd9fg2d9dzzb4x23y8c8r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd9fg2d9dzzb4x23y8c8r.png" alt="Image description" width="463" height="73"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Test Case 4
&lt;/h2&gt;

&lt;p&gt;Add shopping items with the &lt;code&gt;add_item&lt;/code&gt; method.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The input is:&lt;/strong&gt;&lt;br&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Test Case 4
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;print("Test Case 4")&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Test Case 4
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;print("Test Case 4")&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;trnsct_123.add_item(["Ayam goreng", 2, 20000])&lt;/code&gt;&lt;br&gt;
&lt;code&gt;trnsct_123.add_item(["Pasta gigi", 3, 15000])&lt;/code&gt;&lt;br&gt;
&lt;code&gt;trnsct_123.add_item(["Mainan mobil", 1, 200000])&lt;/code&gt;&lt;br&gt;
&lt;code&gt;trnsct_123.add_item(["Mie instan", 5, 3000])&lt;/code&gt;&lt;br&gt;
&lt;code&gt;print(trnsct_123.items)&lt;/code&gt;&lt;br&gt;
&lt;code&gt;print(" ")&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The output is:&lt;/strong&gt;&lt;br&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvlce8h6tua1f8b0jxbhw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvlce8h6tua1f8b0jxbhw.png" alt="Image description" width="800" height="116"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Test Case 5
&lt;/h2&gt;

&lt;p&gt;Order shopping check orders using the &lt;code&gt;check_order&lt;/code&gt; method.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The input is:&lt;/strong&gt;&lt;br&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Test Case 5
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;print("Test Case 5")&lt;/code&gt;&lt;br&gt;
&lt;code&gt;trnsct_123.check_order()&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The output is:&lt;/strong&gt;&lt;br&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgs3atxwc2llpta0q20b6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgs3atxwc2llpta0q20b6.png" alt="Image description" width="757" height="291"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Test Case 6
&lt;/h2&gt;

&lt;p&gt;calculate total expenditure with the &lt;code&gt;total_price&lt;/code&gt; method.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The input is:&lt;/strong&gt;&lt;br&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Test Case 6
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;print("Test Case 6")&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;trnsct_123.total_price()&lt;/code&gt;&lt;br&gt;
&lt;code&gt;print(" ")&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The output is:&lt;/strong&gt;&lt;br&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi14i4c9jnkq0o770modp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi14i4c9jnkq0o770modp.png" alt="Image description" width="436" height="129"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Self-service cashier system is created using the Python programming language to make it easier for customers to carry out shopping transactions. This system has some features such as adding items, updating item names, updating the number of items, updating item prices, deleting one item, deleting all items, calculating the total item price and discounts obtained, and displaying a shopping table.&lt;/p&gt;

&lt;p&gt;Because this cashier system has a self-service concept, the features still can be developed to be more user friendly, such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Using input features to help the customers to add and update/change items that they want to buy without have to type the item's name manually.&lt;/li&gt;
&lt;li&gt;Providing shopping catalog or list of available items in the supermarket that is connected to the database to minimize the errors.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>python</category>
      <category>dataanalytics</category>
      <category>pacmann</category>
      <category>teach4hope</category>
    </item>
  </channel>
</rss>
