Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Requirements for chapter 4 zyLab Full Program: Calculations & Formatting using NETBEANS Problem: A hotel chain wants to try a new swimming pool design for

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 hassix sidesthat are all thesame 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 locations 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 atan()method and aPIconstant, 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 achar),

the city and state location of the hotel (asStrings),

and length of the hexagon side (as adouble).

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:

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intermediate Accounting

Authors: James D. Stice, Earl K. Stice, Fred Skousen

17th Edition

978-0324592375

Students also viewed these Programming questions

Question

What is cultural tourism and why is it growing?

Answered: 1 week ago