Question: Answer using assembly language A widget distributor receives a shipment of N widgets from the manufacturer. Unfortunately, oneeighth of them are not up to specification

Answer using assembly language

A widget distributor receives a shipment of N widgets from the manufacturer.

Unfortunately, oneeighth of them are not up to specification and cannot be shipped.

The remaining widgets are shipped to a central warehouse. A standard mailing box holds 16 widgets and costs $8 to mail.

Any widgets left over are shipped individually at a cost of $2 each.

Write and test a Pep/9 assembly language program that inputs N and outputs the total cost of mailing the widgets. (Cost may be approximate because of limitations of integer arithmetic)

Example N = 300 widgets are received from the manufacturer

One eighth (37) are not up to specification leaving 263 Sixteen boxes of 16 can be filled leaving 7 widgets to be shipped individually

Total cost = (16 * $8) + (7 * $2) = $142

Example program run

N: -2

N: 300

Cost to ship is $142

N: 20

Cost to ship is $12

N: 1

Cost to ship is $2

N: 32766

Cost to ship is $14358

N: 800

Cost to ship is $368

N: 200

Cost to ship is $110

N: 0

Goodbye

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!