请为VB项目提供帮助.为MOD操作员提供新手服务. [英] Please help with VB Project..Novice with MOD operator..Car Rental firm

查看:61
本文介绍了请为VB项目提供帮助.为MOD操作员提供新手服务.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在大学的第一年就有这个VB项目要做,我似乎无法弄清这一切代码...这是一些有关它的信息.

它基于一家虚构的汽车租赁公司,在该公司中,我必须设计一个汽车租赁表格,操作员在与客户通过电话交谈时填写该表格.

其中涉及许多车辆,但在此我将以其中一个为例.

大众Polo-每日价格... 37.50每周价格... 236.25 ...每两周价格... 448.90

儿童座椅... 22.00卫星导航... 5.00车顶架... 45.00.(客户可以选择一个或全部)


如果客户需要租车16天(此数字仅是示例,取决于总租赁期限,则可以是任何天数),费用是通过应用每两周一次的费率并以每天的费率加两天来计算的.报价不含增值税(20%).

我已经找到了使用Visual Basic Express中的datetimepicker计算出租天总数的代码.

我已宣布公共类中的租金率和额外费用为常量
单击为每个车辆分配的单选按钮,即可进行车辆和车辆的选择,并选中其他复选框.

有了这些信息,我需要使用MOD运算符来计算租金的总成本.

I have this VB project to do in my first year at college,with everything else i can''t seem to figure out this bit of code.. Here''s some information about it.

Its based on a fictional car hire firm where i have to design a car rental form that an operator fills out while talking to the client on the phone.

There are a number of vehicles involved,but i will use one as an example here.

VW Polo- Daily rate... 37.50 weekly rate... 236.25...Fortnightly Rate... 448.90

Extras.. Child Seat... 22.00 Sat-Nav... 5.00 Roof Rack... 45.00.(client has a choice of one or all)


If the customer requires the car for 16 days(this number is just an example,it could be any number of days depending on the overall rental period) the cost is calculated by applying the fortnightly rate and adding two extra days at the daily rate.The prices are quoted excluding VAT(20%).

I have figured out the code that calculates the total number of rental days using the datetimepicker in Visual basic express.

I have declared the rental rates and cost of extras as constants in the public class
and vehicle choices are made by clicking on a radiobutton allocated for each vehicle,checkboxes for extras.

With this information i need to calculate the TOTAL COST of the rental using the MOD operator.

推荐答案

mod运算符实际上是除法运算符的一部分:除法为您提供了商,mod为您提供余数.
在您给出的示例中,以每两周一次的速率计算16天:
The mod operator is effectively part of the division operator: divide gives you the quotient, mod gives you the remainder.
In the example you give, 16 days at the fortnightly rate:
16 / 14 = 1  (since there are 14 days is a fortnight)
16 Mod 14 = 2 (since there is a remainder of 2)

所以您需要说的是:

So all you need to say is:

Dim daysAtFortnightRate = daysRented / 14
Dim daysAtDailyRate = daysRented Mod 14

然后您要做的所有工作就是计算出成本,将每个成本乘以相关比率,然后将两个值相加.

Then all you have to do to work out the cost, is multiply each by the relevant rate and add then two values together.


这篇关于请为VB项目提供帮助.为MOD操作员提供新手服务.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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