Hi!
I have this simple program:
program SalaryCalculator;
const
DollarsPerHour: real = 15.50;
var
HoursPerDay, DaysPerMonth, TotalHours: integer;
Salary: real;
begin
WriteLn('Please enter the number of hours you work in a day:');
ReadLn(HoursPerDay);
WriteLn('Please enter the number of days you worked this month:');
ReadLn(DaysPerMonth);
TotalHours := DaysPerMonth * HoursPerDay;
Salary := TotalHours * DollarsPerHour;
WriteLn('The number of hours you work in a month is: ', TotalHours);
WriteLn('Your salary this month is: $', Salary);
ReadLn
end.
The output looks like this:
Please enter the number of hours you work in a day:
6
Please enter the number of days you worked this month:
23
The number of hours you work in a month is: 138
Your salary this month is: $ 2.1390000000000000E+003
Is there a way to specify the number of decimal places for the final Salary value?
Also, see the third to last line and its ouput - there is a space between the dollar sign and the Salary value; is the a way to concatenate two values of a different type without the space and, preferably, without type-conversion?
Thanks!