
380 So.2d 833 (1980)
ZIPPY MART OF ALABAMA, INC., a corp.
v.
A & B COFFEE SERVICE, INC., a corp.
78-844.
Supreme Court of Alabama.
February 29, 1980.
George B. Azar of Azar, Campbell & Azar, Montgomery, for appellant.
Richard M. Jordan of Jordan & Heard, Montgomery, for appellee.
MADDOX, Justice.
A & B Coffee Service entered into a contract to provide coffee to sell in Zippy Mart convenience stores throughout Alabama for a period of eighteen months. After the contract was in force for approximately a year, Zippy Mart notified A & B that it was terminating the agreement. A & B sued Zippy Mart for breach of contract and was awarded a judgment of $19,846.25. Zippy Mart appeals. We reverse and remand.
The crucial issue presented on this appeal is whether the damages awarded are supported by the law and evidence proffered at trial. Zippy Mart contends that A & B failed to prove it was damaged because of the alleged breach.
*834 The evidence tended to show that A & B contracted with Zippy Mart for A & B to place a coffee dispensing machine in each of 89 Zippy Mart stores. Zippy Mart desired a system whereby the customer would be able to obtain a freshly brewed cup of coffee upon purchase. V. L. Beck, Sr., president of A & B, suggested a machine designed so that when the customer pressed a button, the machine would dispense one cup of coffee made from freeze-dried coffee granules. The parties agreed that A & B would provide, install, service, and own the machines. The written contract stated that, "Zippy Mart of Alabama Inc. agrees to purchase all coffee, individual kream, individual sugar, and wrapped stir stix, (cups and lids optional) from A & B Coffee Service Inc. that will be used through said equipment." Zippy Mart was not obligated to purchase the coffee machines at any time. After the machines had been installed one year, an agent of Zippy Mart notified an agent for A & B by telephone that the contract was terminated and A & B should remove the machines.
A & B filed suit alleging Zippy Mart arbitrarily breached the contract, that A & B suffered damages in that it went to great expense in purchasing and installing 89 machines of a special design, that it had purchased supplies for the machines for 18 months, and that Zippy Mart was permitting others to provide the services A & B had contracted to provide.
The trial court, as trier of fact and pursuant to Rule 52, ARCP, found that the freeze-dried coffee system was a very specialized process; that the parties understood that a full eighteen-month contract was necessary in order for A & B to earn a return on its investment; that the machines were installed at substantial expense; that the contract was breached without justification; and that A & B mitigated the damages as best it could.
The court awarded damages based on the loss in value of the specially fitted machines, the cost to A & B of picking up the machines, the special fittings used in the installation of the machines, the specially ordered "stir stix" which were ordered for Zippy Mart and the one hundred and fifty cases of freeze-dried coffee that A & B had purchased and placed in inventory for the expected use by Zippy Mart during the final six months of the contract. The court found that "[t]hese costs, expenses and damages were reasonably contemplated by the parties at the time the contract was entered into."
The finding that Zippy Mart breached its contract with A & B is amply supported by the evidence. Unquestionably, the parties agreed that A & B would have the right to place its machines in the Zippy Mart stores and the coffee and other materials used to produce a cup of coffee were to be purchased only from A & B. The contract was to run for eighteen months. After twelve months, A & B was told to remove its equipment and a competitor was given the right to sell coffee in Zippy Mart stores.
Zippy Mart contends, however, that even if there was a breach, A & B failed to prove that it was damaged.
It is axiomatic that in contract law the primary duty of the court is to put the injured party in the same position he would have been in had the terms of the contract not been violated. Coastal States Life Insurance Company v. Gass, 278 Ala. 656, 180 So.2d 255 (1965); Geohagan v. General Motors Corp., 291 Ala. 167, 279 So.2d 436 (1973).
The evidence is clear that the agreement was designed so that A & B would make its profit by selling the coffee and other supplies to Zippy Mart. The evidence also clearly indicates that A & B believed it would make a profit from its investment in the specially ordered machines if it had the opportunity to supply the coffee-making materials for a period of eighteen months, a period bargained for and agreed upon by the parties. Zippy Mart breached the contract by indicating its desire that A & B remove its machines after only twelve months and permitting the installation of a competitor's equipment in the stores. If Zippy Mart had continued to purchase coffee and supplies from A & B, and use them *835 in the A & B machines for the final six months of the contract, it would have fully performed under the terms of the contract; therefore, the only loss to A & B by the breach was the loss of the sale of the coffee and supplies for the final six months of the term of the contract.
The award of damages for the cost of the specially ordered machines is plain error necessitating reversal. Tanner v. Winfield, 365 So.2d 651 (Ala.1978). The machines remained at all times the property of A & B. A & B claimed it would have to hire someone to travel throughout the state to pick up machines at 89 stores; however, Beck admitted in his deposition, which was introduced as evidence, that A & B intended to have Zippy Mart discard the machines at the end of the eighteen-month period. If Zippy Mart had purchased coffee and supplies necessary for the final six months, Zippy Mart would have fully performed under the contract, and the machines would have been discarded. In short, Zippy Mart promised to purchase coffee and supplies for eighteen months, but only purchased for twelve months. The only damage that flowed from the breach is the loss of the sale by A & B of six months worth of coffee and supplies. Because the judgment entered awards damages in excess of this amount, it is due to be reversed, and the matter remanded for a redetermination of the amount of damages.
Certain principles of law are controlling in the calculation of damages on remand. First, the court must determine the amount of coffee and supplies that Zippy Mart should have purchased during the final six months of the term of the contract. Then, the court must determine whether A & B could have mitigated the damages by reselling the goods. If so, A & B is only entitled to its lost profits. Code 1975, § 7-2-708(2). If not, A & B may recover the price Zippy Mart was due to pay. Code 1975, § 7-2-709.
REVERSED AND REMANDED, WITH DIRECTIONS.
TORBERT, C. J., and JONES, SHORES and BEATTY, JJ., concur.
