Advanced Cashier 2010

anuragcoder -1 Tallied Votes 373 Views Share

This is a program that emulates a supermarket cashier. It includes Login and also
uses EncryPro for encrypting customer ID.

AC 2010 Main Page : code.google.com/p/advancedcashier2010
EncryPro : code.google.com/p/encrypro

//Beta
//
//

#include <iostream>
#include <string>
#include <stdio.h>
#include <conio.h>
#include <fstream>
#include <iomanip>
#include <cstdlib>
#include <time.h>

#define UN "default"
#define PW "default"
char User[21], Pwd[21];
char date [9];

using namespace std;
      void MkAster();
      void PromScr();
      void mainkernel();
int main()
{
    menu:
         
        int c;
        cout << "                       WELCOME                    "<<endl;
        cout << "_____________ADVANCED CASHIER 2010 M3________________"<<endl;
        cout << "What do you want to do?"<<endl;
        cout << "--------------------------------------------------"<<endl;
        cout << "1.Login"<<endl;
        cout << "2.Exit"<<endl;
        cout << "3.About"<<endl;
        cout << "PLEASE READ THE ""README.txt"""<<endl;
        cout << "--------------------------------------------------"<<endl;
        cout << "Please Enter Choice                               "<<endl;
        cin  >> c;
        
        if(c == 1){
             system("cls");
             int att = 4;
             cout << "------------------------------------------------------------------------------------------------------------------------------\n"<<endl;
    	     printf("LoginSafe By: KBM & Envy Inc. \nDeveloped By Inanimate Studios.\nVersion 2.1.2.\n\nPlease enter the following...\n");
    	     cout << "--------------------------------------------------------------------------------------------------------------------------------"<<endl;
    	     cout << "(C) KBM & Envy Inc. Please visit www.envyinc.blogspot.com. "<<endl;
    	
    	for (; att >= 0; att--)
    	{
    		PromScr();
    		
    		if (!stricmp(User, UN) && !strcmp(Pwd, PW))
    		{
    			printf("\nUsername and Password accepted!\n\n");
    			mainkernel();
    			
    		}
    		
    		else if(!stricmp(User, "quit") && !strcmp(Pwd, "exit")){
                 break;
                 }
    		
    		else 
            {printf("\nInvalid Username or Password\n\nYou have %i attempts more.", att);
            }
    	}
}
              
        if(c == 2){
             system("PAUSE");
             }
        if(c == 3){
             cout << "------------------------------------------" << endl;
             cout << "----------------ABOUT---------------------" << endl;
             cout << "------------------------------------------" << endl;
             cout << "The Advanced Cashier 2010 M3 is a program " << endl;
             cout << "to make cashier entries easy and quick.   " << endl;
             cout << "------------------------------------------" << endl;
             cout << "Developed And Compiled by Envy Inc.       " << endl;
             cout << "Special Thanks to KBM and gieselgow for   " << endl;
             cout << "for login and main kernel error debug     " << endl;
             cout << "------------------------------------------" << endl;
             system("PAUSE");
             goto menu;
}
}
// inclomplete class

//Def(Mkaster) Def(PromScr())
//
//PROMSCR
 void PromScr()
    {
    	printf("\nUsername: "); scanf("%s", &User);
    	printf("Password: "); MkAster();
    }
    
//---------------------
//MKASTER    
    void MkAster()
    {
    int i = 0, geth = 0;
    do {
    	
    		geth = getch();
    		if(geth != 13)
    		{
    			if(geth == '\b')
    			{
    				if(i!= 0)
    				{
    					printf("\b \b");
    					Pwd[i] = '\0';
    					i--;
    				}
    			}
    			 else if(geth == '13') printf("\b \b");
    			
    			else 
    			{
    			
    			Pwd[i] = geth;
    			printf("*");
    			i++;
    			}
    		}
    	} while(geth != 13 );
    	
    	Pwd[i] = '\0';
    }

//sum_num.lib
int sum(int b[],int n) 
    { 
      int s=0;
      int i; 
      for(i=0;i<n;i++) 
      { 
                       s+=b[i]; 
                       } 
}

//CASHIER PROGRAM BEGINS..........
//
//________________________________






void runningkernel() 
{ 
    cout<<"press(0) to calculate total price\n"; 
    q:
                    int clientn;
                    string sn;
                    float price,total,payment,balance,quantity; 
                    char date [9]; char time [9];
                    _strdate(date); 
                    _strtime(time); 
                    cout<<"------------------------------------------------------------------"<<endl;
                    cout<<"----------------ADVANCED CASHIER CLIENT NO."<<clientn<<"----------"<<endl;
                    cout<<"------------------------------------------------------------------"<<endl;
                    cout<<"Please Enter Billing Number"<<endl;
                    int bn;
                    cin >> bn;
                    cout<<"Date: "<<date<<endl; 
                    cout<<"Time "<<time<<endl; 
                    cout<<"\t .................................\n"; 
                    cout<<".........................................................\n"; 
                    cout<<"                         "<<"SUPERMARKET BILL ENTRY"<<bn<<"                          "; 
                    cout<<".........................................................\n"; 
                    cout<<"\t .................................\n"; 
                    quantity=0; 
                    total =0; 
                    do
                     { 
                          quantity=quantity+1;
                          cout<<"\t\tPrice for Item No:"<<quantity<<" is :";
                          cin>>price;
                          total = total+price;
                          }while(price!=0);
                          cout<<"\t\tFinal Price\n"<<"\t_________________________________________\n";
                          cout<<"\t\t\t"<<total<<endl;
                          float taxes;
                          cout << "Taxes(if any)" << endl;
                          cin >> taxes;
                          cout<<"\t_________________________________________"<<endl;
                          cout<<"\t\tCash Tendered";
                          cin>>payment;
                          balance=payment-(total+taxes);
                          cout<<"\t\tChange Returned = "<<balance<<endl;
                          cout<<"\t\t\tTHANK YOU. WE HOPE YOU VISIT"<<" "<<sn<<" "<<"AGAIN"<<endl;
                          cout<<"Would you like to serve for the next customer?(1/0)";
                          int g;
                          cin>>g; 
                          if (g == 1) {
                                  cout<<"*************************************************************\n" ;
                                  cout<<"*************************************************************\n";
                                  cout<<""<<endl; goto q;
                                  } 
                                  else 
                                  {cout<<"\t\t**********************\n";
                                  cout<<"\t\t**********CLOSING PROGRAM***********************"<<endl;
                                  cout<<"\t\t**********************"<<endl;
                                  system("PAUSE");
                                  
                                  } 
                                  }

void mainkernel(){
     system("cls");
     cout << "                         ADVANCED CASHIER 2010                 "<<endl;
     cout << "_______________________________________________________________"<<endl;
     cout << "Welcome to the Advanced Cashier. Please enter the name of the  "<<endl;
     cout << "product, then the price and finally the quantity. After you    "<<endl;
     cout << "have finalised the list. Then enter taxes if any and then hit  "<<endl;
     cout << "print to see the list"<<endl;
     cout << "_______________________________________________________________"<<endl;
     system("PAUSE");
     int clientn;
     cout << "Enter Client Number:"<<endl;
     cin >> clientn;
     string sn;
     cout << "Enter Name Of SuperMarket:" << endl;
     cin >> sn;
     runningkernel();
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>> and also uses EncryPro for encrypting customer ID.

In USA customers do not have IDs. Only the cashier logs into the cash register with a user name and password, then he/she starts processing customers, checking/scanning each item, finally receives the money in the form of cash or check or credit/debit card.

Product Name: Bad idea. Should enter a UPC barcode instead so that the exact item, manufacturer, color, size and/or weight can be easily accounted for in the transaction.

As for taxes -- that is computed by the cash register when the cashier presses the Total button. There is no need for human to enter that amount. In my state there are two different kinds of taxes -- one for food (1.7%) and another for everything else (7.?%). Other states may not tax food. The taxes can get a little complicated which is why its better to let a computer calculate it.

How do I know? I am a cashier at WalMart.

anuragcoder -6 Junior Poster in Training

Okay. Thanks For The Reply
Will Bring a Better Milestone.

anuragcoder -6 Junior Poster in Training

Could You Inform Any Better Possibilitites........PM me if so.

steventaal 0 Newbie Poster

BEST_ASTERIK_SYSTEM_EVER!!! wow, that's really good actually. :)

anuragcoder -6 Junior Poster in Training

Thank you. I should basically thank my friend KBM for helping me so.

Agni 370 Practically a Master Poster Featured Poster

Why have you mixed cout and printf ? and read here why system("pause") is not a good idea. and read Djikstra's paper on why "goto" is harmful.

Ketsuekiame commented: Valid points +1
anuragcoder -6 Junior Poster in Training

Yeah, thanks.... I will improve....
I was using primitive methods.

Sorry.... As I said Milestone 4 is on the way...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.