## CS 1401 Assignment #3

Date Assigned: Thursday, September 15, 2005 or Friday, September 16, 2005.

Due Date: correspondingly, Thursday, September 22, 2005, or Friday, September 23, 2005, before the beginning of your lab section.

Goals: The main goal of this assignment is to learn how to implement arithmetic operations in Java.

Points: This assignment is worth a total of 20 points. No late assignments will be accepted, but credit will be given for partially completed assignments turned in on time.

Assignment: Many computer science students have complained about the parking, so Bill Gates donated money to build a parking garage for CS students at UTEP.

There are two competing plans: to place this garage near UTEP campus and to place it across the border so that students will be able to take a shuttle to school.

To help in constructing this garage, we need to design an application that would, given the width and depth of every floor (in feet) and the number of floors:

• compute the overall floor area of the garage (in square feet),
• compute the cost of building this garage on the US side by multiplying its cost-per-square-foot by the overall floor area,
• compute the cost of constructing this garage on the Mexican side by first converting the area into square meters and then multiplying its cost-per-square-meter by the floor area in square meters;
• in both cases, we get a 10% discount - provided that we help by designing such an application.
To earn all of us such a discount, design an application class that will do the following:
• for his or her first name,
• for his or her last name,
• for the width and depth of each floor, and
• for the number of floors;
• compute:
• the area of one floor in square feet;
• the overall floor area in square feet,
• the overall floor area in square meters,
• the price of a US-based garage (before the discount),
• the price of a Juarez-based garage in pesos (before the discount),
• the price of a Juarez-based garage converted to dollars (before the discount),
• the price of a US-based garage (after the discount), and
• the price of a Juarez-based garage converted in dollars (after the discount);
• print a receipt that displays:
• the name of the architect,
• the price of a US-based garage (before the discount),
• the price of a Juarez-based garage in dollars (before the discount),
• the price of a US-based garage (after the discount), and
• the price of a Juarez-based garage in dollars (after the discount).
Keep the price per square foot (at present, \$30), the Juarez price per square meter (at present, 200 pesos), and the discount (at present, 10%) as named constants, to make it easier to change them later on.

It is also a good idea to define FEET_TO_METERS = 0.3048 and PESOS_TO_DOLLARS = 0.1 (for simplicity) as named constants.

Reminder: the area of a rectangular floor is equal to width * depth. A 10% discount means that the actual cost is (1 - 10/100) * original_cost. For example, if the original cost was \$100, after the 10% discount, we only pay \$90.

Example:

• For a 100 feet by 150 feet 3-story garage, the area of each floor is 100 * 150 = 15,000 square feet; so, the area of the whole garage is 3 * 15,000 = 45,000 square feet.
• So, the cost of building this garage in the US (before the discount) is 45,000 * \$30 = \$1,350,000.
• The area in square meters is 45,000 sq.ft * 0.3048 ft/m * 0.3048 ft/m = 4,182 sq.m.
• The cost of constructing this garage in Juarez is (before the discount) is 200 pesos/sq.m * 4,182 sq.m = 836,400 pesos.
• In dollars, that would be 836,400 pesos * 0.1 \$/peso = \$83,640.
• Since you all solved the problem correctly, the contractors give us a discount. After the 10% discount, the US-based cost will be \$1,350,000 * (1 - 0.1) = \$1,215,000.
• After a similar 10% discount, the cost of a Juarez-based garage is \$83,640 * (1 - 0.1) = \$75,276.

Deliverables: as announced in the labs.