February 24, 2017

Homework Help: Computer Programming

Posted by Dom on Tuesday, July 9, 2013 at 8:49pm.

I'm trying to create a vba code that solves this problem: 50 apartment units rent for 600 a month, for each 40 dollar increase in rent a unit becomes unoccupied. I want to find the max profit and number of units at that number.

Sub Rent()
Dim Rent As Variant
Dim increase As Integer
Dim units As Object
Dim Profit As Double
Rent = InputBox("The rent to occupy all the units")
increase = InputBox("The increase in rent that results in a vacant unit")
Rent = Rent + increasea
units = 50
Profit = units * (600 + increase)

Outputbox " " & units & " units and " & Profit & " when profit is maximized."
End Sub

Answer This Question

First Name:
School Subject:

Related Questions

More Related Questions