I can not figure out what to do. I need one html file to read an asp file for these 4 variables (1) intHrlyRate, (2) intWeeklyRate, (3) intMonthlyRate, and (4) intAnnunalRate. I am suppose to use arithmetic functions to calculate the
intWeeklyRate (based on 40 hrs per week and assign value of 10 to intHrlyRate), the intMontlyRate, and the intAnnualRate variables. Using response.write all variables to the screen
My result should be Hourly Rate = 10
Weekly Rate = 400
Monthly Rate = 1733
Annual Rate = 20800
all I can figure out so far is this( which I bet is wrong) NOT Good with Math

I think this is what i am suppose to show for my asp file. I not quite sure how to even start the html file Or do I have this backwards.
<html>
<head>
</head>
<title>arithmetic calculations</title>
<body>
<%
Dim intHrlyRate, intWeeklyRate, intMonthlyRate, intAnnualRate
intHrlyRate = 10
intWeeklyRate = 40
intMonthlyRate = intHrlyRate * intWeeklyRAte
intAnnunalRAte = intHrlyRate * intWeeklyRate * intMonthlyRate
Response.write intHrlyRate
Response.write intWeeklyRate
Response.write intMonthlyRate
Response.write intAnnunalRate


</html>
</body>
Please for the love of God someone take pitty on a poor helpless girl trying to learn asp.

Dani AI

Generated

This thread shows two useful points: server-side VBScript must run from an .asp page (not a plain .html file), and the most predictable way to get a whole-dollar monthly figure is to compute the annual total first and then divide and round. struggled with typos and with how to wire up a page; offered a straightforward approach using an approximation for months. Both are on the right track, but a couple of small best-practices make the result clearer and less error-prone.

Calculate like this for accuracy: weekly = hourly hoursPerWeek; annual = weekly 52; monthly = Round(annual / 12, 0) (or use CInt/CLng if a different conversion is desired). Using 4.33 as a shortcut is acceptable for quick estimates, but deriving monthly from the exact annual value avoids small rounding drift. In Classic ASP, VBScript variables are variants—prefixing with int is only a naming convention—so enable Option Explicit to catch misspellings (the original post had a couple of typos).

Example pattern (Classic ASP) that keeps logic clear and formats output:

<%
Option Explicit
Const HR = 10
Const HRS_PER_WEEK = 40
Const WEEKS_PER_YEAR = 52

Dim weekly, annual, monthly
weekly = HR * HRS_PER_WEEK
annual = weekly * WEEKS_PER_YEAR
monthly = Round(annual / 12, 0)

Response.Write FormatCurrency(HR, 0) & "<br/>"
Response.Write FormatCurrency(weekly, 0) & "<br/>"
Response.Write FormatCurrency(monthly, 0) & "<br/>"
Response.Write FormatCurrency(annual, 0) & "<br/>"
%>

If the page must remain .html, have it request the .asp endpoint (AJAX or an iframe) or insert the server-generated fragment with a server-side include. Common pitfalls: misspelled variable names, relying on float approximations for money, and forgetting to format output for currency.

Recommended Answers

All 2 Replies

This is a very simplistic solution to your problem.

<%
Dim intHrlyRate, intWeeklyRate, intMonthlyRate, intAnnualRate
intHrlyRate = 10 '// $ rate per hour
intWeeklyRate = intHrlyRate * 40 '// hourly rate multiplied by hours per week
intMonthlyRate = 4.33 * intWeeklyRate '// 52 weeks divided by 12 months multiplied by the weekly rate
intAnnunalRAte = 52 * intWeeklyRate '// 52 weeks multiplied by the weekly rate
Response.write "Hourly Rate = $" & intHrlyRate & "<br>"
Response.write "Weekly Rate = $" & intWeeklyRate & "<br>"
Response.write "Monthly Rate = $" & intMonthlyRate & "<br>"
Response.write "Annual Rate = $" & intAnnunalRate & "<br>"
%>

This is a very simplistic solution to your problem.

<%
Dim intHrlyRate, intWeeklyRate, intMonthlyRate, intAnnualRate
intHrlyRate = 10 '// $ rate per hour
intWeeklyRate = intHrlyRate * 40 '// hourly rate multiplied by hours per week
intMonthlyRate = 4.33 * intWeeklyRate '// 52 weeks divided by 12 months multiplied by the weekly rate
intAnnunalRAte = 52 * intWeeklyRate '// 52 weeks multiplied by the weekly rate
Response.write "Hourly Rate = $" & intHrlyRate & "<br>"
Response.write "Weekly Rate = $" & intWeeklyRate & "<br>"
Response.write "Monthly Rate = $" & intMonthlyRate & "<br>"
Response.write "Annual Rate = $" & intAnnunalRate & "<br>"
%>

I found out that my assignment really needed this for the monthrate to come out to 1733. I was told this was needed to do that
intMonthlyRate = CInt(intAnnualRate / 12) '// Annual Rate divided by 12 months the cInt means to divide the annual rate by 12. I missed that other than that he said this was fine.
Thought I would add this for FYI
Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.