我现在正在学校学习编程和软件设计以及 Java。让我混淆的课程是软件设计。我们正在使用 Word 运行简单的 VB 代码来做简单的程序。我的教练说我使用运行总数正在失去凝聚力。我很难想办法避免它们。这是我正在谈论的一些伪代码的示例(这些模块被称为来自未显示的驱动程序模块):
CaluculateDiscountPrice module
DiscountPrice = (FloorPrice * (1 – DiscountRate))
End module
CalculateDeliveryPrice module
If DeliveryFee = “Yes” Then
DeliveryPrice = DiscountPrice + 20
ElseIf DeliveryFee = “No” Then
DeliveryPrice = DiscountPrice
End If
End module
CalculateTradeInCredit module
If TradeInCredit = “Yes” Then
CreditedPrice = DeliveryPrice – 5
ElseIf TradeInCredit = “No” Then
CreditedPrice = DeliveryPrice
End If
End module
CaluculateCostOfBed module
CostOfBed = CreditedPrice
End module
基本上DiscountPrice
是用来连接前两个模块,然后DeliveryPrice
是后两个。据说,最后一个模块甚至可能不需要在那里,我解决了这个问题。对初学者有帮助吗?