# Question: requirements for chapter 4 zylab full program calculations amp formatting...

###### Question details

Requirements for chapter 4 zyLab Full Program: Calculations & Formatting using NETBEANS

Problem:

A hotel chain wants to try a new swimming pool design for several of its locations. The pool shape will be the equivalent of a two regular hexagons joined together by a rectangle, as shown below:

Note that a regular hexagon has **six sides** that
are all the **same length**.

The width of the rectangle that joins the hexagons will be 2.2 times longer than its height. And the height of the rectangle will be the same length as each side of the hexagons.

The overall dimensions of the pool will depend on the space available for each hotel. So for each run of the program, the hotel will supply the location’s hexagon side length (which will be 35 feet or less) to the builder. The builder will then calculate the pool dimensions, to be used to estimate building costs.

Using the formulas below for the hexagons, and knowledge of rectangles, the builder must first compute the area of the pool.

Note that the Java Math class contains a **tan()**
method and a **PI** constant, which must be used
within the program, to implement the computations in this
formula:

Area of a regular hexagon = 6(𝑠𝑖𝑑𝑒2) / 4(tan( 𝜋 / 6 ))

The builder must also compute the perimeter of the pool. And since some of the suppliers are European, both the area and perimeter will also be converted to metric units.

write a Java program that:

Defines constants to hold the following values:

The width of the rectangle is 2.2. times its height

There are 0.3048 meters in one foot

There are 10.7639 square feet in one square meter

NOTE: You must also use each of these constants later in your calculations

Read identifying information about where the hotel is located, including a district letter (A – K), and the city and state where the hotel is located, as follows:

Define variables to hold the user inputs

Read and store the hotel district letter (as a
**char**),

the city and state location of the hotel (as
**Strings**),

and length of the hexagon side (as a
**double**).

NOTE: The hotel city and/or state may contain multiple words and spaces. Be sure to use the correct code to read the entire line, and to read past any newline characters as necessary.

Display two blank lines, followed by the hotel identifying information, formatted as:

NOTES: The district, city and state are right-aligned with the statement above them, and the last letter appears as the 30th character on the line.

At this point, your program should pass zyLabs tests 1 & 2.

Calculate and display the pool area information, as follows:

o Define as many variables as you need to hold the calculations for each area

Use double type variables for all floating point values

o Calculate the areas for the rectangle, and hexagons using the formula on page 1

o Display a blank lines followed by the results of the calculations, as follows:

NOTE: The area values are displayed to 3 decimal places and will line up on the decimals. The area values are also all right-aligned to the same place as the district, city and state.

At this point, your program should pass zyLabs tests 3 & 4.

Calculate and display the total area information in both English and metric

NOTE: Total area values are displayed to 3 decimal places and line up on the decimals with the figures above them (as shown). The dividing line is also right-aligned to the same place. At this point, your program should pass zyLabs tests 5 & 6.

Calculate and display the perimeter information in both English and metric, preceded by one blank line.

NOTE: The perimeter values are displayed to 1 decimal place and will line up on the decimals. The perimeter values (excluding the units) are also all right-aligned to the same place as the area figures, district, city and state. Your program should pass zyLabs all tests

Remember that when developing your program in zyBooks, the inputs and outputs are separate. For the above example, the inputs and outputs would be: