PROGRAM 7: Tuition Calculator
Write an HLA Assembly language program that calculates the cost of tuition at SMC. Different choices will be represented by a bit field as shown below:
Semester Enrolled Units
CA Resident?
Parking Decal?
Since just 8 bits are being entered, your program should expect to read 2 hexidecimal digits.
The four low-order bits (shown in orange) represent the number of enrolled units. Your code should ensure the value is not zero.
The next two bits (shown in purple) represents the term. Some of the different fees various based on the term of enrollment. 00 means Fall, 01 means Winter, 10 means Spring and 11 means Summer.
The next bit (shown in red) represents whether a student is a California resident. O means non-resident, 1 means California resident
The high-order bit (shown in blue) represents whether a students wants to buy a parking decal for this term. O means no parking decal, 1 means parking decal.
Based on these choices, here are the fees that apply to students this Fall 2024:
Fee
Tuition
Parking
Fall or Spring
$50 for parking decal
Winter or Summer
$46 per unit for CA residents
$374 per unit for non-residents
$25 for a parking decal
Below are some sample program dialogues that demonstrate these ideas.
(Hint: Do this in small steps, bit-by-bit. There's alot to it...)
(Further Hint: The most important part of this assignment is to worked with the packed data field entered by the user to extract the sub-parts out of it. The overlapping design of the Intel registers helps you parse this kind
of data field and you can shift the bits around to get the right part into BH or BL, for example...)
(Further Hint: You can read hex numbers by reading directly into a register. Just don't use EAX since stdin.get uses that one when it executes.)
(Final Hint: Since we haven't learned how to do multiplication yet, although it's kinda painful, I was expecting that you would perform the multiplication by a looping set of addition instructions)