Feed me 4 hex digits: 0001 1 Children 0 Adult 0 Senior Citizen No Matinee Discount No Blockbuster Premium Total: $5 Feed me 4 hex digits: 0049 1 Children 1 Adult 1 Senior Citizen No Matinee Discount No Blockbuster Premium Total: $22 Feed me 4 hex digits: 025C 4 Children 3 Adult 1 Senior Citizen Matinee Discount No Blockbuster Premium Total: $41 Feed me 4 hex digits: 045D 5 Children 3 Adult 1 Senior Citizen No Matinee Discount Blockbuster Premium Total: $71

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter4: Selection Structures
Section: Chapter Questions
Problem 7PP
icon
Related questions
Question

PROGRAM 7: Movie Box Office

Write an HLA Assembly language program that calculates the cost of various movie tickets.  The cost will be based on a single 16-bit value entered by the value.  The value will be used to specify a number of adult, senior citizen and children tickets.  In addition, there might be matinee discount for each ticket sold.  There might be a blockbuster premium applied to each ticket sold.  The format of this bit field is diagrammed below:



Three bits are being used to specify the number of child tickets, each costing $5.  Three bits are being used to specify the number of adult tickets, each costing $10.  Three bits are being used to specify the number of senior citizen tickets, each costing $7.  Once all the costs are totaled, the matinee discount should save $2 per ticket.  Once all the costs are totaled, add $1 per ticket for blockbuster premium.

Since 16 bits are being entered here, your program should expect to read 4 hexadecimal digits.

Below are some sample program dialogues that demonstrate these ideas.
(Hint: Do this in small steps, bit-by-bit. There's alot to it... )
(Another Hint: HLA read in hex format when you read directly into a register.  So do that...)
(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... )
(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)

Feed me 4 hex digits: 0001
1 Children
0 Adult
0 Senior Citizen
No Matinee Discount
No Blockbuster Premium
Total: $5

Feed me 4 hex digits: 0049
1 Children
1 Adult
1 Senior Citizen
No Matinee Discount
No Blockbuster Premium
Total: $22

Feed me 4 hex digits: 025C
4 Children
3 Adult
1 Senior Citizen
Matinee Discount
No Blockbuster Premium
Total: $41

Feed me 4 hex digits: 045D
5 Children
3 Adult
1 Senior Citizen
No Matinee Discount
Blockbuster Premium
Total: $71

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Public key encryption
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr