Pages

Showing posts with label Visual Basic Console Application. Show all posts
Showing posts with label Visual Basic Console Application. Show all posts

Monday, 7 December 2015

Buy Restaurant POS Sample

Point of Sale System(POS) is a Computer software that develop by many programmers to help the restaurant upon managing the Sales. This software can generate Daily Sales, Monthly Sales and even the yearly Sales. The Items or the product encoded to the database has been organize and easy to update the new prices and other details to be modify.

Here is the image of Sample Point of Sale System.
User Login Windows

Friday, 30 August 2013

Simple Grading System Using Visual Basic.net Console Application

Download Project

Download Code

Project Specification

Programming Language Use: Visual Basic.Net (Console Application)
IDE : Visual Studio 2010 with version 4.0 .net Framework

Here is the Code:

Imports System.Console
Module Module1


    Dim x As Integer = 5
    Dim pGrade, mGrade, pfGrade, fGrade As Integer
    Dim name, gender, Course, subject, sem_grade, remarks, chc, pass As String
    Dim q1, q2, cs, exam, grade As Integer
    Dim term_grade As Integer
    Dim prelim, midterm, pre_final, final, equi1 As Integer
    Dim equi As Decimal


    Sub Main()
        Clear()
        Title = "Grading System"
        Call student_info()
        Call result()
        Call made()

        'for student_info
        SetCursorPosition(Len("name:") + x + 1, 5)
        name = ReadLine()
        SetCursorPosition(Len("gender:") + x + 1, 6)
        gender = ReadLine()
        SetCursorPosition(Len("course:") + x + 1, 7)
        Course = ReadLine()
        SetCursorPosition(Len("subject:") + x + 1, 8)
        subject = ReadLine()






        'for made=prelim
        SetCursorPosition(Len("Q1:") + x, 14)
        q1 = ReadLine()
        SetCursorPosition(Len("Q2:") + x, 15)
        q2 = ReadLine()
        SetCursorPosition(Len("CS:") + x, 16)
        cs = ReadLine()
        SetCursorPosition(Len("Exam:") + x, 17)
        exam = ReadLine()

        'compute

        pGrade = (((q1 + q2) / 2) * 0.2) + (cs * 0.2) + (exam * 0.6)
        SetCursorPosition(Len("Grade:") + x, 18)
        Write(pGrade.ToString)


        'for made=midterm
        SetCursorPosition(Len("Q1:") + x + 15, 14)
        q1 = ReadLine()
        SetCursorPosition(Len("Q2:") + x + 15, 15)
        q2 = (ReadLine())
        SetCursorPosition(Len("CS:") + x + 15, 16)
        cs = ReadLine()
        SetCursorPosition(Len("Exam:") + x + 15, 17)
        exam = ReadLine()

        mGrade = (((q1 + q2) / 2) * 0.2) + (cs * 0.2) + (exam * 0.6)
        SetCursorPosition(Len("Grade:") + x + 15, 18)
        Write(mGrade.ToString)


        'for made=prefinal
        SetCursorPosition(Len("Q1:") + x + 30, 14)
        q1 = ReadLine()
        SetCursorPosition(Len("Q2:") + x + 30, 15)
        q2 = ReadLine()
        SetCursorPosition(Len("CS:") + x + 30, 16)
        cs = ReadLine()
        SetCursorPosition(Len("Exam:") + x + 30, 17)
        exam = ReadLine()

        pfGrade = (((q1 + q2) / 2) * 0.2) + (cs * 0.2) + (exam * 0.6)
        SetCursorPosition(Len("Grade:") + x + 30, 18)
        Write(pfGrade.ToString)


        'for made=final
        SetCursorPosition(Len("Q1:") + x + 45, 14)
        q1 = ReadLine()
        SetCursorPosition(Len("Q2:") + x + 45, 15)
        q2 = ReadLine()
        SetCursorPosition(Len("CS:") + x + 45, 16)
        cs = ReadLine()
        SetCursorPosition(Len("Exam:") + x + 45, 17)
        exam = ReadLine()


        fGrade = (((q1 + q2) / 2) * 0.2) + (cs * 0.2) + (exam * 0.6)
        SetCursorPosition(Len("Grade:") + x + 45, 18)
        Write(fGrade.ToString)

        sem_grade = (pGrade * 0.2) + (mGrade * 0.2) + (pfGrade * 0.2) + (fGrade * 0.4)
        SetCursorPosition(Len("Semestral Grade:") + x + 30, 5)
        Write(sem_grade.ToString)

        If sem_grade = 75 Or sem_grade = 76 Then
            equi = 3.0
            SetCursorPosition(Len("Equivalent:") + x + 30, 6)
            Write(equi, "{0.00}")
        ElseIf sem_grade = 77 Or sem_grade = 78 Or sem_grade = 79 Then
            equi = 2.75
            SetCursorPosition(Len("Equivalent:") + x + 30, 6)
            Write(equi, "{0.00}")
        ElseIf sem_grade = 80 Or sem_grade = 81 Or sem_grade = 82 Then
            equi = 2.5
            SetCursorPosition(Len("Equivalent:") + x + 30, 6)
            Write(equi, "{0.00}")
        ElseIf sem_grade = 83 Or sem_grade = 84 Or sem_grade = 85 Then
            equi = 2.25
            SetCursorPosition(Len("Equivalent:") + x + 30, 6)
            Write(equi, "{0.00}")
        ElseIf sem_grade = 86 Or sem_grade = 87 Or sem_grade = 88 Then
            equi = 2.0
            SetCursorPosition(Len("Equivalent:") + x + 30, 6)
            Write(equi, "{0.00}")
        ElseIf sem_grade = 89 Or sem_grade = 90 Or sem_grade = 91 Then
            equi = 1.75
            SetCursorPosition(Len("Equivalent:") + x + 30, 6)
            Write(equi, "{0.00}")
        ElseIf sem_grade = 92 Or sem_grade = 93 Or sem_grade = 94 Then
            equi = 1.5
            SetCursorPosition(Len("Equivalent:") + x + 30, 6)
            Write(equi, "{0.00}")
        ElseIf sem_grade = 95 Or sem_grade = 96 Or sem_grade = 97 Then
            equi = 1.25
            SetCursorPosition(Len("Equivalent:") + x + 30, 6)
            Write(equi, "{0.00}")
        ElseIf sem_grade = 98 Or sem_grade = 99 Or sem_grade = 100 Then
            equi = 1.0
            SetCursorPosition(Len("Equivalent:") + x + 30, 6)
            Write(equi, "{0.00}")

        ElseIf sem_grade < 75 Then
            equi = 5.0
            SetCursorPosition(Len("Equivalent:") + x + 30, 6)
            Write(equi, "{0.00}")

        End If



        If sem_grade >= 75 Or sem_grade <= 100 Then
            SetCursorPosition(Len("Remarks:") + x + 30, 7)
            Write("Passed")
        ElseIf sem_grade < 75 Then
            SetCursorPosition(Len("Remarks:") + x + 30, 7)
            Write("Failed")
        Else
            SetCursorPosition(Len("Remarks:") + x + 30, 7)
            Write("Unknown")

        End If

        Call all()
        ReadLine()
    End Sub
    Private Sub student_info()

        SetCursorPosition(x, 5)
        Write("Name:")
        SetCursorPosition(x, 6)
        Write("Gender:")
        SetCursorPosition(x, 7)
        Write("Course:")
        SetCursorPosition(x, 8)
        Write("Subject:")
        SetCursorPosition(x + 30, 5)
        Write("Semestral Grade:")
        SetCursorPosition(x + 30, 6)
        Write("Equivalent:")
        SetCursorPosition(x + 30, 7)
        Write("Remarks:")
        SetCursorPosition(x, 9)
        Write("---------------------------------------------------")

    End Sub
    Private Sub result()
        SetCursorPosition(x, 12)
        Write("Prelim")
        SetCursorPosition(x + 15, 12)
        Write("Midtrem")
        SetCursorPosition(x + 30, 12)
        Write("pre-final")
        SetCursorPosition(x + 45, 12)
        Write("Final")
    End Sub
    Private Sub made()
        SetCursorPosition(x + 15, 14)
        Write("Q1:")
        SetCursorPosition(x + 15, 15)
        Write("Q2:")
        SetCursorPosition(x + 15, 16)
        Write("CS:")
        SetCursorPosition(x + 15, 17)
        Write("Exam:")
        SetCursorPosition(x + 15, 18)
        Write("Grade:")

        'for midterm
        SetCursorPosition(x + 30, 14)
        Write("Q1:")
        SetCursorPosition(x + 30, 15)
        Write("Q2:")
        SetCursorPosition(x + 30, 16)
        Write("CS:")
        SetCursorPosition(x + 30, 17)
        Write("Exam:")
        SetCursorPosition(x + 30, 18)
        Write("Grade:")

        'for pre-final
        SetCursorPosition(x + 45, 14)
        Write("Q1:")
        SetCursorPosition(x + 45, 15)
        Write("Q2:")
        SetCursorPosition(x + 45, 16)
        Write("CS:")
        SetCursorPosition(x + 45, 17)
        Write("Exam:")
        SetCursorPosition(x + 45, 18)
        Write("Grade:")

        'for final
        SetCursorPosition(x, 14)
        Write("Q1:")
        SetCursorPosition(x, 15)
        Write("Q2:")
        SetCursorPosition(x, 16)
        Write("CS:")
        SetCursorPosition(x, 17)
        Write("Exam:")
        SetCursorPosition(x, 18)
        Write("Grade:")
        SetCursorPosition(x, 20)
        Write("Another Entry[Y/N]:")


    End Sub
    Private Sub all()

        SetCursorPosition(Len("Another Entry[Y/N]:") + x + 1, 20)
        chc = ReadLine()

        While chc.ToUpper = "Y".ToUpper
            Call Main()
        End While
        SetCursorPosition(5, 22)
        Write("Press any key to...")
    End Sub
End Module


Friday, 29 March 2013

How to Use the For loop in Visual Basic.net Console Application?

For Loop is a kind of iteration statement which allows the statement repeatedly executed. The statement repeat until the limitation or the condition of the for loop is TRUE. This kind of iteration statement is always use if the statement needs to repeat many time.

To print many times of "Hello World!" must need to use the for loop so that the line of code written in a simple. The code below a sample of for loop statement that print 10 times of "Hello World!".

Module Module1
    Sub Main()
        For x As Integer = 1 To 10
            Console.WriteLine("Hello World!")
        Next
        Console.ReadLine()
    End Sub
End Module


Remember:

The X on the for loop statement above is the variable assign as integer value when the statement repeat.

The 1 value is Initialization or the Start value of the for loop statement and the 10 value is the limitation of the for loop statement.

        For x As Integer = Start To Limitation
        

        Next

The Programmer can also use the manual coding to print 10 times of "Hello World!" but what if 1000 times to repeat the "Hello World". Is it the programmer use the manual code? its better that the programmer use the for loop statement to do that kind of coding.

Base on the code above, The Programmer change the Value 10 into 1000 in the for loop statement above. It shows the code below to print 1000 times of "Hello World!"

Module Module1
    Sub Main()
        For x As Integer = 1 To 1000
            Console.WriteLine("Hello World!")
        Next
        Console.ReadLine()
    End Sub
End Module


How to Print Numbers from the Highest number to the lowest Number Using For loop?

         To print numbers from 10 to 1 using the for loop is just change the position of the Start and the Limitation of for loop statement.

Module Module1
    Sub Main()
        For x As Integer = 10 To 1 Step -1
            Console.WriteLine(x)
        Next
        Console.ReadLine()
    End Sub
End Module


How it is Happen? 

         The Start value of x is 10 and the limitation value of the for loop statement is 1 and if you notice that is has a Step -1 in a for loop statement. Step -1 is a function to do the numbers loop in to backward counting.

here is the further explanation why is it happen that the numbers counting from the highest into lowest value.

Remember 10 is the starting and 1 is the Limitation and the for loop statement must be true, if the statement is false then the Step -1 will trigger and the  value of x is deducted by 1.

Let's test now...

        the starting value of x is 10
  • Meaning to say that 10 must be the first value to print because it  is  the first value of x.
        limitation value is 1
        
        the condition is this:
             is it 10 is equal to 1?  if the Answer is FALSE then Step -1 will action and the value deducted into 1 and the new value of x is 9 and the new value of x will print which is 9. so we have already 10 and 9 printed into the screen which is show like these;

                    10

                                            9
      the for loop statement repeat until the condition is TRUE which is if the value of x is 1. It shows the output below if the for loop is stop to repeat the statement.

How to use the SetCursorPosition in Visual Basic Console Application?

          The purpose of SetCursorPosition () is to set the text on it's position. It has an X and Y position value which is the X is the horizontal position and the Y is the vertical position of the text. Always remember that it's position accept only an integer or single numeric value.

Here is the code of SetCursorPosition()

Module Module1

    Sub Main()
        Console.SetCursorPosition(5, 3)
        Console.WriteLine("Programming!")
        Console.ReadLine()
    End Sub

End Module 


Note:
The Value 3 on the SetCursorPosition is the Vertical Position of the text and the value 5 is the Horizontal Position of the text.

The image below is the output of SetCursorPosition()





How to Program "Hello World!" in Visual Basic.net Console Application?

Module Module1

   sub Main()

     Console.Writeline("Hello World!")
     Console.Readline()

   End Sub

End Module

Note:
  • The purpose of Console.Writeline is to print the Word "Hello World".
  • The purpose of Console.Readline() is to read and hold the screen output of the code.

The Image below is the output of the code.


Visual basic .net

           is an Object-Oriented Programming Languages which implemented to dot net Framework and the evolution of Visual Basic(VB). This type of Programming language is easy to design and write the source code even the error of debugging is easy to solve.
Why Visual Basic.net is easy to Design?

          Visual Basic.net is a drag and drop which means means all objects is on the package of    the software and the programming drag only the object from the tools and drop into the form.

Performing the Drag and Drop Method.