Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Programming Project 3 - Living on Mars Note: When you turn in an assignment to be graded in this class, you are making the

imageimage

Programming Project 3 - Living on Mars Note: When you turn in an assignment to be graded in this class, you are making the claim that you neither gave nor received assistance on the work you turned in (except, of course, assistance from the instructor or teaching assistants). Mars is not a friendly place to live. There are strong winds that settlers have to deal with. With this in mind, settlers need to build "round" houses, or houses that are in the shape of an octagon. There is no precipitation, so the roof and floors are flat. In order to plan for building their houses, the settlers want a program to calculate the rough estimate of the cost of their house based on the house wall size they pick. The program will be called MartianHouses.java. The user will enter their name and then the length of one side, s, in terms of feet of the house they wish to build. The program will calculate the base cost of the house using the formulas provided below, using the length of the side, s. area of flooring or roof = 2s(1+2), area of outer walls = 8.12.s total surface area = floor area + outer wall area + roof area The program will display the name of the settler and then the house's total surface area as well as the cost per square foot all on one line. The base cost per square foot is $14.50. Each calculation will be rounded to two decimal places using print formatting, printf(). After the first planet's calculations are performed and printed, the program should ask the user if they would like to continue. They will type in the word "no" if they wish to end the program. They can enter anything else to continue. If they continue, they will then be prompted to enter a new settler's name and length of the house side. Note for Gradescope Testing: Place your scanner declaration above your loop. Use nextLine() for all String inputs. Remember that combining .nextLine() and .nextInt() can cause unexpected behavior (Discussed on slide 43 of Chapter 4 powerpoint) You should use nextLine().trim() for the last String input of if you would like to continue or not. You will also need to use printf() for printing and rounding your values. Note that you will need commas in your numeric output. You cannot use System.exit() to end your loop. You must use your loop control variable containing the value "no" to end the loop.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Heres a Java program named MartianHousesjava that implements the requirements you provided import ja... blur-text-image

Get Instant Access to Expert-Tailored 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

Government and Not for Profit Accounting Concepts and Practices

Authors: Michael H. Granof, Saleha B. Khumawala

6th edition

978-1-119-4958, 9781118473047, 1118155971, 1118473043, 978-1118155974

More Books

Students also viewed these Programming questions

Question

What are the four main types of reports required of a single audit?

Answered: 1 week ago