Application of Payment of Goods to a Store in Programming Language C

in utopian-io •  7 years ago  (edited)

What Will I Learn?

Create a Payment App

Requirements

Dev C++ 5.11

Difficulty

  • Intermediate

Tutorial Contents

Theory
The store is a place used for business for buying and selling goods. In the store a lot of shopping materials that can be purchased in accordance with the needs.

At this point I will try to create an app for the store. This application will be used on the cashier. Usefulness of this application to determine the purchase price of an item in accordance with the order.
Every price of goods already in the input will be displayed the price. Regardless of the amount everything will be automatically listed on the end result.

Okay now we will try to make the application.

Now will make the project for the price list of goods that correspond with the data input.

Here I use C Language in Programming.

Follow the following program code.

int main(void){
 int totalOil, totalBread, totalfragrance, totalSampoo, totalPaper, TotalCleanser, totalSoap, TotalMarkers, totalSnack, TotalBeans, Price, Pay, Rest;
 char j;
 printf("\nWELCOME TO CUTHAMZA SHOP\n");
 printf("\n");
 printf("------------------------------------\n");
 printf("\nGoods Purchase List:\n");
 printf("\n1. Cooking oil     : "); scanf("%d", &totalOil);
 printf("2. Bread           : "); scanf("%d", &totalBread);
 printf("3. Fragrances      : "); scanf("%d", &totalfragrance);
 printf("4. Sampoo          : "); scanf("%d", &totalSampoo);
 printf("5. Wrapping paper  : "); scanf("%d", &totalPaper);
 printf("6. Cleaners        : "); scanf("%d", &TotalCleanser);
 printf("7. Soap            : "); scanf("%d", &totalSoap);
 printf("8. Marker          : "); scanf("%d", &TotalMarkers);
 printf("9. Snacks          : "); scanf("%d", &totalSnack);
 printf("10.Beans           : "); scanf("%d", &TotalBeans);
 if (totalOil>=0 && totalBread>=0 && totalfragrance>=0 && totalSampoo>=0 && totalPaper>=0 && TotalCleanser>=0 && totalSoap>=0 && TotalMarkers>=0 && totalSnack>=0 && TotalBeans>=0){ Price=(9500*totalOil)+(8700*totalBread)+(500*totalfragrance)+(7500*totalSampoo)+(200*totalPaper)+(12000*TotalCleanser)+(3500*totalSoap)+(6000*TotalMarkers)+(500*totalSnack)+(4500*TotalBeans);
   Pay:
   printf("\n\nTotal Payment Is : $.%d",Price);
   printf("\nPayment             : $."); scanf("%d", &Pay);
   if (Pay>=Price && Pay>=0){
   printf("REST                    : $.%d",Rest=Pay-Price);
   printf("\n\nTHANK YOU FOR YOUR TRUST!\n\n");
   } else {
     printf("\nSorry, Your Money Less  %d for this transaction\n\n",Rest=-(Pay-Price));
     ask:
     printf("Please Press 'Y' to repost, or 'C' to cancel\n");
     scanf("%s",&j);
        if(j=='y'||j=='Y'){
  goto Pay;
       }else if(j=='c'||j=='C'){
  printf("\n\nPlease Press 'Y' to repost, or 'C' to cancel\n\n");
       }else{
  printf("\n\nSorry, the input you entered is incorrect, please repeat it\n");
  goto ask;
       }
     }
   } else {
   printf("\nSorry, your item amount is wrong. Please check back.\n\n");
 }
 return 0;
}code>


Untitled.png
2.png



Result Works

Here the application is run

For cooking option all contents 2

For a choice of bread in the contents of 5

For the choice of fragrances in the contents of 6

For Sampoo option in content 2

For wrapping paper option in content 7

For cleaner option in content 4

For soap option in content 5

For Marker option in content 5

For Snack option in content 2

For Beans option in content 8

After all entered I enter.

When the application is run, told to enter the number of goods as they have taken. After that automatically there is a price that must be paid.

Looks like the picture below.

4.png



Here the application is run

For cooking option all contents 5

For a choice of bread in the contents of 7

For the choice of fragrances in the contents of 8

For Sampoo option in content 5

For wrapping paper option in content 8

For cleaner option in content 9

For soap option in content 2

For Marker option in content 4

For Snack option in content 5

For Beans option in content 6

When the application is run, told to enter the number of goods as they have taken. After that automatically there is a price that must be paid. But when the price entered does not match then there will be a notice to add payment

Looks like the picture below.

5.png



Here the application is run

For cooking option all contents 5

For a choice of bread in the contents of 7

For the choice of fragrances in the contents of 8

For Sampoo option in content 5

For wrapping paper option in content 8

For cleaner option in content 9

For soap option in content 2

For Marker option in content 4

For Snack option in content 5

For Beans option in content 6

To reset the payment error then selected y.

It will automatically be told to enter the price again sebernarnya

6.png



Finish

Thanks You



@cuthamza





Posted on Utopian.io - Rewarding Open Source Contributors

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Your contribution cannot be approved because it does not follow the Utopian Rules.

Hi, there are a few problems with your contribution

  • The linked repository has nothing to do with the tutorial. Since you want to write C tutorials, you should find one of its open-source frameworks, libraries etc. and write a tutorial about that instead (and link that as a repository).
  • Your tutorial doesn't actually teach anything. You just give a big block of code and tell the reader to run it. That's not what a tutorial is supposed to do.

For future tutorials I recommend that you work on your formatting (use ``` above and below code blocks) and as I mentioned earlier, find an open-source project you can contribute to and create a tutorial about that instead (and link its repository).

You can contact us on Discord.
[utopian-moderator]

Hey @amosbastian, I just gave you a tip for your hard work on moderation. Upvote this comment to support the utopian moderators and increase your future rewards!

Thank you for the contribution. It has been approved.

Nyo ka ku approved beh...

Emang bereh

are u a teacher? @cuthamza

Yes I am

  ·  7 years ago (edited)

Thank you for your contribution. It has been approved.
nice post, you can buy gold, and don't forger to merried.

[mod] you can chat me on Discont

Oman hna can ka diskon lom

Banyak yang udah pprove euuhhh...

belum hay butuh belajaar lagi. ada aturan