我们试图限制可以在我们的计划中选择某一天的人数 [英] We're trying to limit the amount of people who can choose a certain day on our program

查看:75
本文介绍了我们试图限制可以在我们的计划中选择某一天的人数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我们的程序是理发店预约调度程序唯一的问题是,我们不能限制可以在某一天任命的人数。例如,一百万人可以在2016年12月4日要求预约。我们想将这个数字限制在15左右。我们的教授告诉我们使用If Statement,但我们没有运气。



我尝试过的事情:



So our program is a barbershop appointment scheduler the only problem is, is that we cannot limit the amount of people who can make their appoint on a certain day. For instance a million people could request an appointment on 12/4/2016. We want to limit that number to 15 or so. Our professor told us to use an If Statement, but we have had no luck with it.

What I have tried:

Public Class appointmentform
    
    Private Sub MonthCalendar1_DateSelected(sender As Object, e As DateRangeEventArgs) Handles MonthCalendar1.DateSelected

        Dim MonthCalendar1 As Integer
        If MonthCalendar1 > 5 Then

            MessageBox.Show("This day is full, please select another day to come in.")
        End If
        datetxt.Text = MonthCalendar1.SelectionEnd.ToShortDateString() 'displays date selected into textbox
    End Sub



    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles btnPreview.Click
        '"If" statements that cover the haircut options the customer may choose

        lstOutput.Items.Clear()

        lstOutput.Items.Add(nametxt.Text)

        Dim totalreceipt As Double

        If haircut.Checked Then
            totalreceipt += lstOutput.Items.Add(15.ToString("C"))
        End If

        If specialcut.Checked Then
            totalreceipt += lstOutput.Items.Add(20.ToString("C"))
        End If

        If kidcut.Checked Then
            totalreceipt += lstOutput.Items.Add(12.ToString("C"))
        End If

        If lineup.Checked Then
            totalreceipt += lstOutput.Items.Add(7.ToString("C"))
        End If

        If design.Checked Then
            totalreceipt += lstOutput.Items.Add(5.ToString("C"))
        End If

        If razorshave.Checked Then
            totalreceipt += lstOutput.Items.Add(15.ToString("C"))
        End If

        If seniorcut.Checked Then
            totalreceipt += lstOutput.Items.Add(12.ToString("C"))
        End If

        If eyebrow.Checked Then
            totalreceipt += lstOutput.Items.Add(10.ToString("C"))
        End If

        If diamondkut.Checked Then
            totalreceipt += lstOutput.Items.Add(45.ToString("C"))
        End If

        lstOutput.Items.Add(datetxt.Text)


    End Sub




    Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles viewfinal.Click
        'Displays message box to customer for confirmation
        MessageBox.Show("See you soon " & nametxt.Text & "!" & " Thank you for choosing Thig's Diamond Kutz, your appointment is set for " & datetxt.Text & ".", "Appointment Confirmation")

        'Stores data in text file
        Dim file As System.IO.StreamWriter
        file = My.Computer.FileSystem.OpenTextFileWriter("appointmentstorage.text", True)
        file.WriteLine(lstOutput)
        file.Close()

    End Sub

    Private Sub appointmentform_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        'users are unable to access dates to have already passed
        MonthCalendar1.MinDate = Date.Today

    End Sub
End Class

推荐答案

我们不做你的HomeWork。

HomeWork不会在乞求别人做你的工作时测试你的技能,它会让你思考并帮助你的老师检查你对你所学课程的理解。还有你在应用它们时遇到的问题。

你的任何失败都会帮助你的老师发现你的弱点并设定补救措施。

所以,试一试,重读你的课程并开始工作。如果您遇到特定问题,请显示您的代码并解释这个问题,我们可能会提供帮助。



作为程序员,您的工作是创建算法解决特定问题,你不能依赖别人永远为你做,所以有一段时间你必须学会​​如何。而且越快越好。

当你要求解决方案时,就像试图通过培训其他人来学习开车一样。

创建算法基本上是找到数学并做出必要的调整以适应你的实际问题。



We do not do your HomeWork.
HomeWork is not set to test your skills at begging other people to do your work, it is set to make you think and to help your teacher to check your understanding of the courses you have taken and also the problems you have at applying them.
Any failure of you will help your teacher spot your weaknesses and set remedial actions.
So, give it a try, reread your lessons and start working. If you are stuck on a specific problem, show your code and explain this exact problem, we might help.

As programmer, your job is to create algorithms that solve specific problems and you can't rely on someone else to eternally do it for you, so there is a time where you will have to learn how to. And the sooner, the better.
When you just ask for the solution, it is like trying to learn to drive a car by having someone else training.
Creating an algorithm is basically finding the maths and make necessary adaptation to fit your actual problem.

引用:

我们的教授告诉我们使用If语句,但我们没有运气。

Our professor told us to use an If Statement, but we have had no luck with it.

这不是运气问题!

限制预订的人数预约一天,你需要知道当天已预订了多少,然后这是一个简单的测试。



请注意每日限制问题来自你处理约会的不切实际的方式。我猜所有客户都可以在17:00来到并且仍然遵守作业规则。

实际上,你必须处理预约时间,你必须防止2人同时预订,它解决了你的每日最高限额。

It is not a matter of luck!
To limit the number of people that book an appointment for a day, you need to know how many have already booked for the day, then it is a simple test.

Note that the daily limit problem comes from the unrealistic way you handle the appointments. I guess that all customers can come at 17:00 and still respect the rules of the assignment.
In reality, you have to handle time of appointment and you have to prevent 2 people from booking at same time, which solve your maximum daily limit.


这篇关于我们试图限制可以在我们的计划中选择某一天的人数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆