Consider a staircase made of concrete as shown in the following diagram, which depicts a four-step...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Consider a staircase made of concrete as shown in the following diagram, which depicts a four-step staircase. The dimensions of the staircase are called the width (width of each step), the run (the depth of each step), and the rise (the height of each step): double x; int xRounded Your job is to write a program named Staircase.java that prompts the user for the number of steps in the staircase. It will then prompt for and read the width, rise, and run of a step in centimeters. The program will then calculate the number of cubic centimeters of concrete necessary to build the staircase. Round the number of cubic centimeters up to the nearest whole number by using the Math.ceil() method and casting that result to an integer. In general, = blocks (int) (Math.ceil(x)); n(n+1) 2 Hints: How many “blocks” the size of the bottom step do you need to build the staircase? Drawing a diagram really helps. If you have n steps, the total number of blocks you need is the sum of the numbers 1 through n, which you can calculate with this formula: Here is what program output might look like: width Staircase Volume Calculator How many steps in the staircase? 5 Enter step width in cm: 45 Enter rise of the step in cm: 7.5 run Enter run of the step in cm: 20 Total volume is 101250 cubic centimeters. rise The name of your Java class must be Staircase. Remember to include comments at the beginning of your program that give your name, the date, and a description of the program's purpose. The description must be sufficient for someone who has not read the assignment to be able to understand what the program does. Consider a staircase made of concrete as shown in the following diagram, which depicts a four-step staircase. The dimensions of the staircase are called the width (width of each step), the run (the depth of each step), and the rise (the height of each step): double x; int xRounded Your job is to write a program named Staircase.java that prompts the user for the number of steps in the staircase. It will then prompt for and read the width, rise, and run of a step in centimeters. The program will then calculate the number of cubic centimeters of concrete necessary to build the staircase. Round the number of cubic centimeters up to the nearest whole number by using the Math.ceil() method and casting that result to an integer. In general, = blocks (int) (Math.ceil(x)); n(n+1) 2 Hints: How many “blocks” the size of the bottom step do you need to build the staircase? Drawing a diagram really helps. If you have n steps, the total number of blocks you need is the sum of the numbers 1 through n, which you can calculate with this formula: Here is what program output might look like: width Staircase Volume Calculator How many steps in the staircase? 5 Enter step width in cm: 45 Enter rise of the step in cm: 7.5 run Enter run of the step in cm: 20 Total volume is 101250 cubic centimeters. rise The name of your Java class must be Staircase. Remember to include comments at the beginning of your program that give your name, the date, and a description of the program's purpose. The description must be sufficient for someone who has not read the assignment to be able to understand what the program does.
Expert Answer:
Answer rating: 100% (QA)
import javautilScanner public class Staircase public static void mainString args Scanner scanner new ... View the full answer
Related Book For
Managerial accounting
ISBN: 978-0471467854
1st edition
Authors: ramji balakrishnan, k. s i varamakrishnan, Geoffrey b. sprin
Posted Date:
Students also viewed these programming questions
-
You work at a law firm, and you have been instructed by your supervising attorney to determine if the firm's client, Peterson, would be able to file and win a lawsuit against Electric General...
-
Are there dangers with incarcerating young people in detention facilities? What about the potential for negative long-term impact? Using three documented examples of misconduct/mistreatment of youth...
-
THIRD AVENUE SOFTWARE HEALTH-CARE APP PROJECT This case is new for the ninth edition of Information Technology Project Management . The case provides an opportunity to apply agile and Scrum...
-
Strike Bowling installs automatic scorekeeping equipment with an invoice cost of $180,000. The electrical work required for the installation costs $8,000. Additional costs are $3,000 for delivery and...
-
Use Guess elimination to solve : 8x 1 + 2x 2 2x 3 = 2 10x 1 + 2x 2 + 4x 3 = 4 12x 1 + 2x 2 + 2x 3 = 6 Employ partial pivoting and check your answers by substitute them into the original equations.
-
The Monday morning meeting is just starting. The room is full of individuals from the HR team. As the newest member and most well trained on statistics and HR analytics, you are looked to by staff to...
-
Is there a single standard command-line processor to parse and process argv?
-
Preparing budgets with multiple products Hammond Fruits Corporation wholesales peaches and oranges. Lashanda King is working with the company's accountant to prepare next year's budget. Ms. King...
-
Explain how a company uses a database management system to manage data collection, manipulate data and realize benefits from usage of a database management system.?
-
(a) For the circuit in Fig. 4.138, obtain the Thevenin equivalent at terminals a-b. (b) Calculate the current in RL = 8(. (c) Find RL for maximum power deliverable to RL. (d) Determine that maximum...
-
Write a mathematical journal connected to what you have learned about solving logarithmic equations and inequalities. Try to relate your writing or reflections on our lesson. Law is a system of rules...
-
What does the abbreviation CPC stand for? what is its working ?write a brief discussion .
-
What are the problems with the ideal CNN model? explain all the problems .
-
Write a function append_fr : 'a list -> 'a list -> 'a list that returns a list containing the elements in the first list at the front of the second, with the order of the two lists preserved. Your...
-
A 3 0 0 g bird flying along at 6 . 0 0 m / s sees a 1 5 . 0 g insect heading straight toward it with a speed of 2 5 . 0 m / s ( as measured by an observer on the ground, not by the bird ) . The bird...
-
A horizontal torque=10.0 Nm is applied at the edge of the top face of a hollow cylindrical rod. The base of the rod is fixed to the surface. The outer radius of the cylinder is ro=0.040 m and the...
-
1.3 y 3.1 3 x-3 f1(x)=- 2-x-18 15 -0.1 A student recognizes that x = 9 will cause the denominator to be zero in the given function. What, if anything, does this tell you about the limit as x->9 ? The...
-
The nitrogen atoms in N2 participate in multiple bonding, whereas those in hydrazine, N2H4, do not. (a) Draw Lewis structures for both molecules. (b) What is the hybridization of the nitrogen atoms...
-
Every relevant cost is controllable. However, not all controllable costs are relevant. Why are these two statements correct?
-
What is an input price variance?
-
Tubbs and Company manufactures custom motorcycles. Tubbs uses a job-cost system and provides the following information related to the work-in-process account for the month of January: January 1...
-
The global market presents firms with more complex ethical issues than they would experience if operations were limited to one country and one culture. Moral standards vary across cultures. In some...
-
Bhopal is a city in central India with a population, in 1984 , of 800,000 . Because it was, at that time, home to the largest mosque in India, Bhopal was a major railway junction. Its main industries...
-
PricewaterhouseCoopers (or PwC, as it is known), one of the United States' "Big 4" accounting firms, has had a tax practice in Russia since the time that country changed from Communist rule. One of...
Study smarter with the SolutionInn App