Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Main Module
- Start
- Call GlobalVar(count_p, count_s, p_min, p_max, s_min, s_max, count, c_profit, total, discount, index)
- Call Form()
- End
- Module GlobalVar( out count_p, out count_s, out p_min, out p_max, out s_min, out s_max, out count, out c_profit, out total, out discount, out index)
- count_p = 0, count_s = 0, p_min = 0, p_max = 0, s_min = 0, s_max = 0, count = 0, c_profit = 0, total = 0, discount = 0.2, index = 0
- Return
- Module Form()
- Call Title()
- Display " -------------- " , newline
- Display " | 1 - Register | " , newline
- Display " | 2 - Login | " , newline
- Display " | 3 - Exit | " , newline
- Display " -------------- " , newline
- Display " => "
- Read log
- Display newline
- if (log == 1)
- Call Regist(reg_user, reg_pass)
- else
- if (log == 2)
- Call Login(reg_user, reg_pass)
- else
- if (log == 3)
- Display "Thank you for using our system!"
- else
- Display "Invalid Input!"
- Call Form()
- Endif
- Endif
- Endif
- Return
- Module Title()
- Display " ------------------------------------------" , newline
- Display "| Welcome to VIR Online Bus Ticket Booking |" , newline
- Display " ------------------------------------------" , newline
- Return
- Module Regist(out reg_user, out reg_pass)
- user = ""
- Do
- Display " Enter Username: "
- Read reg_user
- user += reg_user
- Display newline
- Display " Enter Password: "
- Read reg_pass
- Display newline
- Display " Re-Enter Password: "
- Read reg_rpass
- while (reg_pass != reg_rpass)
- Call Form()
- Return
- Module Login(in reg_user, in reg_pass)
- Display " Enter Username: "
- Read user_id
- Display newline
- Display " Enter Password: "
- Read user_pass
- Display newline
- if (user_id == "admin" && user_pass == " 1234")
- Call AdminPanel(c_profit, total, count_p, count_s, count)
- else
- if (user_id != reg_user && user_pass == reg_pass)
- Display " Invalid Username! " , newline
- Call Login(reg_user, reg_pass)
- else
- if (user_id == reg_user && user_pass != reg_pass)
- Display "Invalid Password!" , newline
- Call Login(reg_user, reg_pass)
- else
- if (user_id != reg_user && user_pass != reg_pass)
- Display " Invalid username & Password! " , newline
- Call Login(reg_user, reg_pass)
- else
- Call TicketSystem()
- Endif
- Endif
- Endif
- Endif
- Return
- Module AdminPanel(in c_profit, in total, in count_p, in count_s, in count)
- Display " ------------------------ ", newline
- Display " | Welcome To Admin Panel | ", newline
- Display " ------------------------ ", newline , newline
- Display " ------------------------- ", newline
- Display " | 1 - Transaction History | ", newline
- Display " | 2 - Company Profit | ", newline
- Display " | 3 - Total Sales | ", newline
- Display " | 4 - Min & Max Sales | ", newline
- Display " | 5 - Average Total Sales | ", newline
- Display " | 6 - User Login | ", newline
- Display " ------------------------- ", newline
- Display " => "
- Read admin
- if (admin == 1)
- Call Transaction(user, phone, Location, Destination, day, month, year, b_time, seat, p_discount)
- else
- if (admin == 2)
- Call Profit(c_profit)
- else
- if (admin == 3)
- Call TotalSales(total)
- else
- if (admin == 4)
- Call MinMax(count_p, count_s)
- else
- if (admin == 5)
- Call Average(total, count)
- else
- if (admin == 6)
- Call Form()
- else
- Display " Invalid choice! "
- Call AdminPanel(c_profit, total, count_p, count_s, count)
- Endif
- Endif
- Endif
- Endif
- Endif
- Endif
- Return
- Module Transaction(in user, in phone, in Location, in Destination, in day, in month, in year, in b_time, in seat, in p_discount)
- Display " -------------------- ", newline
- Display " | Ticket Information | ", newline
- Display " -------------------- ", newline
- Display " ------------------------------------------------- ", newline
- Display " | Username : " , user , newline
- Display " | Phone Number : " , phone , newline
- Display " | Location : " , Location , newline
- Display " | Destination : " , Destination , newline
- Display " | Date Depart : " , day , '/' , month , '/' , year , newline
- Display " | Time Depart : " , b_time , newline
- Display " | Bus Type : " , b_type_ , newline
- Display " | Bus Seat : " , seat , newline
- Display " | Total Price : " , p_discount , newline
- Display " ------------------------------------------------ ", newline
- Display " Back to Admin Panel / User Login ? <A/U> ", newline
- Display " => "
- Read admin2
- if (admin2 == 'A')
- Call AdminPanel(c_profit, total, count_p, count_s, count)
- else
- if (admin2 == 'U')
- Call Form()
- else
- Display " Invalid choice! ", newline
- Call AdminPanel(c_profit, total, count_p, count_s, count)
- Endif
- Endif
- Return
- Module Profit(in c_profit)
- c_profit += (total * 0.3)
- Display " Company Profit is : RM ", c_profit , newline
- Display " Back to Admin Panel / User Login ? <A/U> ", newline
- Display " => "
- Read admin2
- if (admin2 == 'A')
- Call AdminPanel(c_profit, total, count_p, count_s, count)
- else
- if (admin2 == 'U')
- Form()
- else
- Display " Invalid choice! "
- Call AdminPanel(c_profit, total, count_p, count_s, count)
- Endif
- Endif
- Return
- Module TotalSales(in total)
- Display " Total Sales Today is : RM" , total , newline
- Display " | Back to Admin Panel / User Login ? <A/U> | ", newline
- Display " => "
- Read admin2
- if (admin2 == 'A')
- Call AdminPanel(c_profit, total, count_p, count_s, count)
- else
- if (admin2 == 'U')
- Call Form()
- else
- Display " Invalid choice! ", newline
- Call AdminPanel(c_profit, total, count_p, count_s, count)
- Endif
- Endif
- Return
- Module MinMax(in count_p, in count_s)
- if (count_p < count_s)
- Display " Minimum company sales is Perdana Express which is : " , count_p , newline
- Display " Maximum company sales is Sani Express which is : " , count_s , newline
- Endif
- if (count_s < count_p)
- Display " Minimum company sales is Sani Express which is : " , count_s , newline
- Display " Maximum company sales is Perdana Express which is : " , count_p , newline
- Endif
- if (count_s == count_p)
- Display " Company sales Perdana Express is equal to Sani Express which is : " , count_s , newline
- Endif
- Display " Back to Admin Panel / User Login ? <A/U> " , newline
- Display " => "
- Read admin2
- if (admin2 == 'A')
- Call AdminPanel(c_profit, total, count_p, count_s, count)
- else
- if (admin2 == 'U')
- Call Form()
- else
- Display " Invalid choice! " , newline
- Call AdminPanel(c_profit, total, count_p, count_s, count)
- Endif
- Endif
- Return
- Module Average(in total, in count)
- average = total / count
- Display " | Average total sales from " , count , " user today is : RM" , average , newline
- Display " | Back to Admin Panel / User Login ? <A/U> | " , newline
- Display " => "
- Read admin2
- if (admin2 == 'A')
- Call AdminPanel(c_profit, total, count_p, count_s, count)
- else
- if (admin2 == 'U')
- Call Form()
- else
- Display " ----------------- " , newline
- Display " | Invalid choice! | " , newline
- Display " ----------------- " , newline
- Call AdminPanel(c_profit, total, count_p, count_s, count)
- Endif
- Endif
- Return
- Module TicketSystem()
- Call Title()
- Display " | Location | | Destination |" , newline
- Display " ------------ ------------- " , newline
- Display " | Kelantan | | Kelantan |" , newline
- Display " | Terengganu | | Terengganu |" , newline
- Display " | Pahang | | Pahang |" , newline
- Display " Please Enter Your Location: "
- Read Location
- Display " Please Enter Your Destination: "
- Read Destination
- Call Formula(p_ticket_discount)
- Call DepartDate(day, month, year)
- Display newline
- Display " Enter Phone Number: "
- Read phone
- Display newline
- Call BusType(b_type, count_p, count_s)
- Call Seat(seat)
- Return
- Module Formula(out p_ticket_discount)
- if (Location == "Kelantan")
- if (Destination == "Terengganu")
- p_ticket = 15.00
- p_discount = p_ticket * 0.8
- p_ticket_discount = p_ticket * discount
- else
- if (Destination == "Pahang")
- p_ticket = 35.00
- p_discount = p_ticket * 0.8
- p_ticket_discount = p_ticket * discount
- else
- Display " Invalid Destination "
- Endif
- Endif
- else
- if (Location == "Terengganu")
- if (Destination == "Kelantan")
- p_ticket = 15.00
- p_discount = p_ticket * 0.8
- p_ticket_discount = p_ticket * discount
- else
- if (Destination == "Pahang")
- p_ticket = 17.00
- p_discount = p_ticket * 0.8
- p_ticket_discount = p_ticket * discount
- else
- Display " Invalid Destination "
- Endif
- Endif
- else
- if (Location == "Pahang")
- if (Destination == "Kelantan")
- p_ticket = 35.00
- p_discount = p_ticket * 0.8
- p_ticket_discount = p_ticket * discount
- else
- if (Destination == "Terengganu")
- p_ticket = 17.00
- p_discount = p_ticket * 0.8
- p_ticket_discount = p_ticket * discount
- else
- Display " Invalid Destination "
- Endif
- Endif
- else
- Display " Invalid Location! "
- Endif
- Endif
- Endif
- Return
- Module DepartDate(out day, out month, out year)
- Display " Please Enter Depart Date " , newline
- Display " | Day [DD]: | => "
- Read day
- Display newline
- Display " | Month [MM]: | => "
- Read month
- Display newline
- Display " | Year [YYYY]: | => "
- Read year
- Return
- Module BusType(out b_type , out count_p, out count_s)
- Display " --------------------- ---------- " , newline
- Display " | Bus Type | | Time | " , newline
- Display " --------------------- ---------- " , newline
- Display " | 1 - Perdana Express | | 9.00 A.M | " , newline
- Display " | 2 - Perdana Express | | 2.00 P.M | " , newline
- Display " | 3 - Perdana Express | | 6.30 P.M | " , newline
- Display " | 4 - Perdana Express | | 10.30 P.M| " , newline
- Display " | 5 - Sani Express | | 10.00 A.M| " , newline
- Display " | 6 - Sani Express | | 4.00 P.M | " , newline
- Display " | 7 - Sani Express | | 8.30 P.M | " , newline
- Display " | 8 - Sani Express | | 11.00 P.M| " , newline
- Display " --------------------- ---------- " , newline
- Display " Please Enter The Number Of Bus Type "
- Read b_type
- Display newline
- if(b_type == 1)
- b_type_ = "Perdana Express"
- b_time = "9.00 A.M"
- count_p++
- else
- if(b_type == 2)
- b_type_ = "Perdana Express"
- b_time = "2.00 P.M"
- count_p++
- else
- if(b_type == 3)
- b_type_ = "Perdana Express"
- b_time = "6.30 P.M"
- count_p++
- else
- if(b_type == 4)
- b_type_ = "Perdana Express"
- b_time = "10.30 P.M"
- count_p++
- else
- if(b_type == 4)
- b_type_ = "Perdana Express"
- b_time = "10.30 P.M"
- count_p++
- else
- if(b_type == 5)
- b_type_ = "Sani Express"
- b_time = "10.00 A.M"
- count_s++
- else
- if(b_type == 6)
- b_type_ = "Sani Express"
- b_time = "4.00 P.M"
- count_s++
- else
- if(b_type == 7)
- b_type_ = "Sani Express"
- b_time = "8.30 P.M"
- count_s++
- else
- if(b_type == 8)
- b_type_ = "Sani Express"
- b_time = "11.00 P.M"
- count_s++
- else(b_type > 8)
- Display "Invalid Choice"
- Endif
- Endif
- Endif
- Endif
- Endif
- Endif
- Endif
- Endif
- Endif
- Return
- Module Seat(out seat)
- cout << " Choose Seat :"
- Read seat
- Call Print_Ticket()
- Return
- Module Print_Ticket(in Location, in Destination, in day, in month, in year, in b_time, in seat, in p_ticket, in p_ticket_discount, in p_discount, in user_id, in, phone, in index, in total, in count)
- Display " -------------------- " , newline
- Display " | Ticket Information |" , newline
- Display " -------------------- " , newline
- Display " ------------------------------------------------- " , newline
- Display " | Location : " , Location , newline
- Display " | Destination : " , Destination , newline
- Display " | Date Depart : " , day , '/' , month , '/' , year , newline
- Display " | Time Depart : " , b_time , newline
- Display " | Bus Type : " , b_type_ , newline
- Display " | Bus Seat : " , seat , newline
- Display " | Ticket Price : RM" , p_ticket , newline
- Display " | Discount Price : RM" , p_ticket_discount , newline
- Display " | Ticket Discount : RM" , p_discount , newline
- Display " | Username : " , user_id , newline
- Display " | Phone Number : " , phone , newline
- Display " ------------------------------------------------ " , newline
- index++
- total += p_discount
- count++
- Display " | Do You Wish To Buy Another Ticket? <Y/N> | " , newline
- Display " => "
- Read choice
- if (choice == 'Y')
- Call TicketSystem()
- else
- if (choice == 'N')
- Display " | Thank You for using our program! | " , newline
- Call Form()
- else
- Display " | Invalid Choice! | " , newline
- Endif
- Endif
- Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement