Skip to content

This is a beginner level GO project using which you can order food in a restaurant.

Notifications You must be signed in to change notification settings

softcodenet/Order-Food

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About

This is a beginner's GOlang project. I have written a program using which you can order food in a restaurant.

Objective

  • Learn Go lang and build project as a beginner.
  • Enhance Go skills and learnings by building project.

Prerequisite

You should have basic knowledge of Go language like data types, if-else statement, loops, switch-statement, slices, maps and structures. If you don't know anything about Go language, then do checkout the resoruces section and you'll be good to go.

Resources

  1. Go Beginner Project Tutorial - Learn Golang
  2. Golang Tutorial for Beginners

Overview

Want to order food!? Well, you have come to the right place(not exactly :P).

This is a program which will help you order food in a restaurant named "Jaipur Bhojanalya".

You can order any item that is there in the menu, and as many times as you want. This program also lets you modify your order by allowing you to update quantity of an item, add an item in the order or delete an item from the order; before generating the final bill.

Key-topics

  • Golang basics
    • Fmt (Printf and Scan)
    • Variables and Data types
    • Type Conversion
    • String padding
    • Conditionals(if/else)
    • Switch Statement
    • Arrays and Slices
    • Maps
    • Structs

Learnings

There are several things that I learnt while building this project. I am sharing it, so that you can refer it if you get stuck.

  1. How to append in a slice of struct?

    Let say struct type name is NewStruct and we defined a new variable with the name a.

     type NewStruct struct{
     		   itemName string
     		   price uint
     		   quantity uint
     		}
     
     //To append use the below code: 
    
     a = append(a, NewStruct{itemName: name, price: bill, quantity: noOfPlates}
    
  2. What happens when you loop through an string, slice, map?

    Read for-loop range and unexpected values range to clear your doubts.

  3. Time function : E.g., time.Now()

    • Read this article to gain more insights.
  4. Random function : E.g.,randIntn(500), rand.Seed(time.Now().Unix());

    • Refer to this if you get stuck
  5. Delete from a map : delete(mapName, key)

Sneak peek

Here are some screenshots of the program in running.

image image image image

About

This is a beginner level GO project using which you can order food in a restaurant.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages