Newbie, junior, senior programmer, Simple POS system
Newbie, junior, senior programmer, Simple POS system
|
Feb 20 2023, 12:29 PM, updated 2y ago
Return to original view | IPv6 | Post
#1
|
Senior Member
1,206 posts Joined: Dec 2007 From: Kuala Lumpur |
Requirement, Create a simple POS system that take in customer order and calculates the total amount of the order. This seems like a simple question that suits 1st assignment of the programming language class. Let see how the Newbie, Junior Programmer, Senior Programmers' work. And discuss why the program classified as such (N,J,S) This post has been edited by WongGei: Feb 20 2023, 12:30 PM |
|
|
|
Feb 21 2023, 10:27 AM
Return to original view | IPv6 | Post
#2
|
Senior Member
1,206 posts Joined: Dec 2007 From: Kuala Lumpur |
QUOTE(angch @ Feb 20 2023, 07:06 PM) CODE # Define the menu with prices menu = { "Hamburger": 5.00, "Cheeseburger": 6.00, "Hot Dog": 4.00, "French Fries": 3.00, "Soda": 1.50, "Water": 1.00 } # Initialize variables order_total = 0.00 order_items = [] # Take customer order while True: item = input("Please enter an item name (or 'done' to complete the order): ") if item.lower() == "done": break elif item in menu: order_items.append(item) order_total += menu[item] print(f"{item} added to order (total: ${order_total:.2f})") else: print("Sorry, that item is not on the menu.") # Print order details print("\nOrder Summary:") for item in order_items: print(f"- {item}: ${menu[item]:.2f}") print(f"Total: ${order_total:.2f}") Chances are we can write the code Here that we can ignore some of the data At the image just because There isn't much point for me to Grab the tiny pixels of information my Poor eyesight can read. Text that can be copied and pasted is much better. Pros: Data and Algorithm are separated. Data can be changed with out affecting the algorithm. Con: Still need to be compiled and deployed if any changes. From my opinions, This should be a Junior Programmer work. |
|
Feb 21 2023, 11:13 AM
Return to original view | IPv6 | Post
#3
|
Senior Member
1,206 posts Joined: Dec 2007 From: Kuala Lumpur |
QUOTE(silverhawk @ Feb 21 2023, 10:30 AM) Its not as simple as it looks Good questions. The moment you have sets, things get really complicated. Are the sets only bundles? Do they have conditional requirements? are set values fixed or percentage off? coupon and voucher rules, etc That's the questions that a senior programmer should ask before he/she even start coding. |
|
Feb 21 2023, 12:24 PM
Return to original view | IPv6 | Post
#4
|
Senior Member
1,206 posts Joined: Dec 2007 From: Kuala Lumpur |
QUOTE(flashang @ Feb 21 2023, 12:03 PM) You might need to think about how to control if sold out, The question are mostly out of scoop.which required inventory control. For each order of "YOU TIAO" ala carte / SET A / SET B / SET C / SET E have to deduct the stock balance of product "YOU TIAO" So your MENU / SET setup need to link to products. Some product may have "optional", such as Soya bean : "Cold / Hot", "no sugar", "standard", "less sugar", "extra sugar". Porridge : "no spring onion", "extra egg". Some products may have to do dispose before closing of the day. Even the hot/cold, no sugar and etc wont affect the calculation of the price. This is just a program that calculate the price of an order, not inventory control system. |
|
Feb 21 2023, 12:30 PM
Return to original view | IPv6 | Post
#5
|
Senior Member
1,206 posts Joined: Dec 2007 From: Kuala Lumpur |
QUOTE(cassian948 @ Feb 21 2023, 12:11 PM) So, unless the customer explicitly orders a set, each item should charge individually and not automatically discounted as a set? This is a very good question.Imagine you are a customer, how you would like the system to have? If you just like to have a You Tiao and your friend just like to have a Tau Fu Fa, how will you order? I will qualify the question as a question that a junior programmer will ask cause it will still need to recompile the program every time changes happen? |
|
Feb 21 2023, 04:36 PM
Return to original view | IPv6 | Post
#6
|
Senior Member
1,206 posts Joined: Dec 2007 From: Kuala Lumpur |
QUOTE(WongGei @ Feb 20 2023, 12:29 PM) Requirement, Create a simple POS system that take in customer order and calculates the total amount of the order. This seems like a simple question that suits 1st assignment of the programming language class. Let see how the Newbie, Junior Programmer, Senior Programmers' work. And discuss why the program classified as such (N,J,S) The program do what its suppose to do and should get full mark for the assignment. Why I classify it as a newbie program. 1.) No seperation of data and algorithm 2.) Any changes require recompile , testing and deployment Attached File(s) newbie.gz ( 1.04k ) Number of downloads: 8 |
|
Feb 22 2023, 10:52 AM
Return to original view | IPv6 | Post
#7
|
Senior Member
1,206 posts Joined: Dec 2007 From: Kuala Lumpur |
QUOTE(flashang @ Feb 21 2023, 11:32 PM) How many marks you could get is depends on marking scheme, and this is based on what are the expected work. e.g. working code : 50% (every major bug -10%) use object : 15% use inheritance : 10% use struct : 10% use switch case : 5% load data from file, not variables : 10% Note : program with bugs may have higher marks if more criteria are met. Total : 100% Grade : 0~20% F 21~40% E 41~49% D 50~70% C 71~80% B 81~90% A 91~100% A+ These are just some assumption. |
|
Feb 23 2023, 04:46 PM
Return to original view | IPv6 | Post
#8
|
Senior Member
1,206 posts Joined: Dec 2007 From: Kuala Lumpur |
QUOTE(WongGei @ Feb 21 2023, 04:36 PM) After rolling my eye for 24 hours, finally the newbie vesion is out. After study for some time, a newbie learn how to separates data with algorithm and make the program more easy to change.The program do what its suppose to do and should get full mark for the assignment. Why I classify it as a newbie program. 1.) No seperation of data and algorithm 2.) Any changes require recompile , testing and deployment Still, need to recompile and deploy program every time changes involved. Attached File(s) junior.gz ( 1.38k ) Number of downloads: 5 |
|
|
|
Feb 24 2023, 01:29 PM
Return to original view | IPv6 | Post
#9
|
Senior Member
1,206 posts Joined: Dec 2007 From: Kuala Lumpur |
QUOTE(silverhawk @ Feb 23 2023, 11:20 PM) Its a good question, not necessarily a "junior" question. This is just an application. Depends on who and how it is used. The one who defines that system is not the customer, but the company. From user perspective, they don't really care. Many POS still can't do auto sets, and in the past this is how some workers used to cheat money from the customer and company. They would quickly switch ala carte and set pricing so customer pays higher but they record as set in the system and pocket the difference. . I used the above menu as a example is not a coincidentally. I was at one of the outlet last week. Was placing the order of a soya bean because I was thirty. Then I watch the cashier key in my order. Then I feel like a bit of hungry, so, I add-on a you tiao in my order. The cashier just press one button (or move his hand once) to add my "you tiao" order. And I ask how much, surprisingly he quote me the set price instead of 2 alarcart order, without erasing my previous order and re-key in (No more moving hand nor fingers). It means the system can automatic give you offer of the set price when your alarcart meet the set requirement. That inspire me to create a thread and discuss about this. So far I haven't see any "codemaster" that can come out with the algorithm to do that. |
|
Feb 24 2023, 01:39 PM
Return to original view | IPv6 | Post
#10
|
Senior Member
1,206 posts Joined: Dec 2007 From: Kuala Lumpur |
QUOTE(silverhawk @ Feb 23 2023, 11:20 PM) The one who defines that system is not the customer, but the company. From user perspective, they don't really care. Many POS still can't do auto sets, and in the past this is how some workers used to cheat money from the customer and company. They would quickly switch ala carte and set pricing so customer pays higher but they record as set in the system and pocket the difference. . |
|
Feb 25 2023, 10:53 AM
Return to original view | IPv6 | Post
#11
|
Senior Member
1,206 posts Joined: Dec 2007 From: Kuala Lumpur |
QUOTE(angch @ Feb 24 2023, 08:03 PM) Heh, some business requirements may be counter intuitive. e.g. Nice feature to have.1. Burger RM8 2. Fries RM3 3. Drink RM3 Set A: Burger+Fries+Drink = RM10 Someone who just order burger and drink is actually better off getting set A, which contained fries they don't want. So, should the optimizer auto add a Fries to the person's order to get Set A? Or should the system leave it to the cashier? Or can the system handle a Set with optional components? e.g. Order Set A, minus Fries? Anyone tried ordering kopi-o kosong tanpa kopi before? Might be cheaper than their mineral water... Let consider how people reaction. 1.) Junior Programmer :- ha? Like this also can ah ...how to do ah? 2.) Senior Programmer :- Wah lau Eh ... siao meh ... who is going to use it ... ok lah ....not that hard. 3.) Project Manager :- Em ... nice feather, but how long to implement and probably noone will use it 4.) System Architect :- Em ... we should build the framework to enable this 5.) IT firm boss :- This one may be we need it. But not at this moment 6.) Client :- Oh ...interesting. I can use it 7.) Environmentalist :- It's a waste of resource, let boycott the shop. So, which level are you in? This post has been edited by WongGei: Feb 25 2023, 10:56 AM |
|
Feb 27 2023, 10:41 AM
Return to original view | IPv6 | Post
#12
|
Senior Member
1,206 posts Joined: Dec 2007 From: Kuala Lumpur |
QUOTE(kingkingyyk @ Feb 26 2023, 06:05 PM) It is quite subjective whether to implement the optimizer or not. This are true statement and often wrongly interpreted, either by cashier or staff on the ground.- Customer might be ordering for few person and going to split the bill later on. - Company decided to go evil to earn more money by hiding the promotion, so even the customer ordered the item as found in the set, it still charge as single item. The requirements definitely need some static testing. First of all, noone forced to have a promotion except the owner of the business. So, the owner already make the calculation and find that it is worth, then only the promotion is being launched. Client will definitely welcome the promotion because they can pay less for more. The only person that doesn't like the promotion might be the middle and lower management of the business, because they are not the direct beneficial of the campaign. As a programmer, we should always/try to enable the business owner to earn more income. How often we go to the bank or other business and we are forced to do things in wired way. Just like the credit/debit card terminal in GSC, that need to tap two times to make payment. Anyone notice that? For me, the optimizer is not a must, but good to have feather. As a programmer, no matter this feather will be in/out from the current project, it is good to know that there are something out there that need to be done, either by yourself or someone who will take over your position. If you have time, do make some planning or create a program that can be modified to have that. |
|
Feb 27 2023, 05:46 PM
Return to original view | IPv6 | Post
#13
|
Senior Member
1,206 posts Joined: Dec 2007 From: Kuala Lumpur |
QUOTE(FlierMate4 @ Feb 27 2023, 04:38 PM) Unlike your newbie.cpp, the junior.cpp cannot run by Dev-C++, it reported errors: compiler too old. Need C++11 or newer compiler. Try to set the option of your compiler to -std=c++11CODE 106 1 C:\Users\~User~\Downloads\junior.cpp [Error] could not convert '{"1", "3", "7"}' from '<brace-enclosed initializer list>' to 'std::vector<std::basic_string<char> >' 106 1 C:\Users\~User~\Downloads\junior.cpp [Error] could not convert '{"2", "3", "7"}' from '<brace-enclosed initializer list>' to 'std::vector<std::basic_string<char> >' 106 1 C:\Users\~User~\Downloads\junior.cpp [Error] could not convert '{"4", "3", "7"}' from '<brace-enclosed initializer list>' to 'std::vector<std::basic_string<char> >' 106 1 C:\Users\~User~\Downloads\junior.cpp [Error] could not convert '{"1", "3", "6", "7"}' from '<brace-enclosed initializer list>' to 'std::vector<std::basic_string<char> >' 106 1 C:\Users\~User~\Downloads\junior.cpp [Error] could not convert '{"2", "3", "6", "7"}' from '<brace-enclosed initializer list>' to 'std::vector<std::basic_string<char> >' 106 1 C:\Users\~User~\Downloads\junior.cpp [Error] could not convert '{"4", "3", "6", "7"}' from '<brace-enclosed initializer list>' to 'std::vector<std::basic_string<char> >' However, it runs successfully using Visual Studio. So it must be something to do with configuration in Dev-C++. P.S. C++11 is a C++ standard that is released at 2011, which is 12 years ago. The latest standard is C++20 FlierMate4 liked this post
|
|
Feb 28 2023, 09:58 PM
Return to original view | IPv6 | Post
#14
|
Senior Member
1,206 posts Joined: Dec 2007 From: Kuala Lumpur |
Finally, refreshed my c++ skill to current c++ standard.
Amazed with the ever revolving c++ standard Attached File(s) senior.gz ( 10k ) Number of downloads: 5 |
|
|
|
Mar 1 2023, 01:11 PM
Return to original view | IPv6 | Post
#15
|
Senior Member
1,206 posts Joined: Dec 2007 From: Kuala Lumpur |
QUOTE(WongGei @ Feb 28 2023, 09:58 PM) I classify it as a work of senior programmer based on the following criteria1.) menu and order are read in from file instead of key in manually, this make the program easy to process big amount of data. 2.) Separating static data (menu) storage with program binary make the program much more easy to adopt changes. Changes in menu, that can happen time to time doesn't require re-compile of binary files. FlierMate4 liked this post
|
|
Mar 2 2023, 09:31 AM
Return to original view | IPv6 | Post
#16
|
Senior Member
1,206 posts Joined: Dec 2007 From: Kuala Lumpur |
QUOTE(flashang @ Mar 1 2023, 10:27 PM) IMHO, Its hard for a guys like you to understand. .....The menu.csv file do not have row header, which make changes confuse. A complete project might include presentation or demonstrate how it work and what are the expected results. By the way, does anyone test the program to see if the program running with a "user understand" way ? Will you create some user manual to let people know how to use the senior version ? 1.) The menu.csv wont be edited by human. Even though it can be done easily. 2.) This is a demo program to showcase programming skill, not project management , presentation skill 3.) I test it and it works. Can't you compile the source? If you are unable to compile the program, learn how to compile and run it first, like @FlierMate4 4.) Nope unless you pay me for that. The source is already open. Its an open source version not spoon feeding version. This post has been edited by WongGei: Mar 2 2023, 09:32 AM |
|
Mar 2 2023, 09:35 AM
Return to original view | IPv6 | Post
#17
|
Senior Member
1,206 posts Joined: Dec 2007 From: Kuala Lumpur |
|
|
Mar 2 2023, 01:55 PM
Return to original view | IPv6 | Post
#18
|
Senior Member
1,206 posts Joined: Dec 2007 From: Kuala Lumpur |
QUOTE(FlierMate4 @ Mar 2 2023, 01:45 PM) I run senior.cpp with Visual Studio 2022, no problem. try -std=c++20But again, not able to compile and run senior.cpp using Dev-C++, it complains: CODE 3755 14 C:\Program Files (x86)\Dev-Cpp\MinGW64\lib\gcc\x86_64-w64-mingw32\4.9.2\include\c++\bits\stl_algo.h [Error] invalid use of 'auto' And point to file in 'std_algo.h'. I use the same compiler option for c++11. Thanks for any help. |
|
Mar 2 2023, 02:04 PM
Return to original view | IPv6 | Post
#19
|
Senior Member
1,206 posts Joined: Dec 2007 From: Kuala Lumpur |
QUOTE(FlierMate4 @ Mar 2 2023, 01:43 PM) Below is the output running using the default order.txt. Updated the output to make it easier to understand how the sum being calculated.The predefined order is A1, D: A1: CODE A1,Set A - Butterfly Bun + Porridge,3.2,1,7 CODE 1,Butterfly Bun,1.0,1 7,Dry Scallop Porridge,2.5,7 D: CODE D,Set D - Tao Foo Far + Soya Bean,3.9,3,6 CODE 3,Soya Bean,2.0,3 6,Tao Foo Far,2.2,6 The total price should be RM 7.10, but I see RM 6.90.... The C++ code crafted by WongGei is beyond my level, since junior.cpp, I am not able to fully understand his C++ code, as my level is newbie.cpp. Price of A1 + D = 3.2 + 3.9 = 7.1 But 1,7,3,6 can form a set E1, which the price is 6.9 This post has been edited by WongGei: Mar 2 2023, 02:07 PM Attached File(s) senior.gz ( 1.95k ) Number of downloads: 2 FlierMate4 liked this post
|
|
Mar 3 2023, 11:09 AM
Return to original view | IPv6 | Post
#20
|
Senior Member
1,206 posts Joined: Dec 2007 From: Kuala Lumpur |
QUOTE(flashang @ Mar 2 2023, 07:23 PM) It might be too harsh if speak directly. As I said, you will never undestand the work of programmer. Why reinvent the wheel?don't take it too serious as this is only personal opinion. This are what tested : CODE Case 1 : menu.csv and order.txt exists : A1 D ==== 7 1 6 3 ==== 6.9 Case 2 : only order.txt exists : A1 D ==== Error in order file, please check 0 Case 3 : only menu.cs exist : Case 4 : both menu.cs & order.txt missing : ==== ==== 0 The "senior" version read data from menu.csv & order.txt, do some matching and display total amount. What was missing ? * it does not "take in customer order" -- which was done in "newbie" & "junior" version. * it only shows numbers and code, no product name -- which was done in "newbie" & "junior" version. * the error message "Error in order file, please check" misleading user to search for wrong direction. it should be "menu.csv error or not found" If "The menu.csv wont be edited by human", are the "order.txt" should be edit by user ? because this do not accept user to key in order. If there is a front-end to write the input / output work for you. Why do you need to duplicates the work? A junior can write the program to generate orders.txt and update the menu.csv accordingly. A senior will write a program to do the calculation. Don't waste a senior time to do things that can be done by a junior. Another reason why it has been done this way is I can ask ChatGPT to create a program to take in order and save it into the order.txt file format for me. Then I just have to write a program to do the calculation. This post has been edited by WongGei: Mar 3 2023, 03:34 PM |
Change to: | 0.0259sec
0.50
7 queries
GZIP Disabled
Time is now: 29th March 2024 - 08:44 AM |