Calculate and output the walls area

Assignment Help Computer Engineering
Reference no: EM132106379

This program has five (5) errors in it that require you to debug it. As you find an error, be sure to document what you changed using in-code commenting. . Below is an explanation of how the program should work.

(1) Prompt the user to input a wall's height and width. Calculate and output the wall's area.

Enter wall height (feet): 12 Enter wall width (feet): 15 Wall area: 180.0 square feet

(2) Extend to also calculate and output the amount of paint in gallons needed to paint the wall. Assume a gallon of paint covers 350 square feet. Store this value using a const double variable.

Enter wall height (feet): 12 Enter wall width (feet): 15 Wall area: 180.0 square feet Paint needed: 0.5142857142857142 gallons

(3) Extend to also calculate and output the number of 1 gallon cans needed to paint the wall. Hint: Use a math function to round up to the nearest gallon.

Enter wall height (feet): 12 Enter wall width (feet): 15 Wall area: 180.0 square feet Paint needed: 0.5142857142857142 gallons Cans needed: 1 can(s)
Here is the code below

import java.util.Scanner;
import java.lang.Math;

public class PaintEstimator {
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
double wallHeight = 0.0;
double wallWidth = 0.0;
double wallArea = 0.0;
double gallonsPaintNeeded = 0.0;
int cansNeeded = 0;

final double squareFeetPerGallons = 350.0;
final double gallonsPerCan = 1.0;

System.out.println("Enter wall height (feet): ");
wallHeight = scnr.nextDouble();
// Prompt user to input wall's width
System.out.println("Enter wall width (feet): ");
wallHeight = scnr.nextDouble();
// Calculate and output wall area
wallArea = wallHeight * wallWidth;
System.out.println("Wall area: square feet");
// Calculate and output the amount of paint in gallons needed to paint the wall
gallonsPaintNeeded = wallArea/squareFeetPerGallons;
System.out.println("Paint needed: " + gallonspaintneeded + " gallons");
// Calculate and output the number of 1 gallon cans needed to paint the wall, rounded up to nearest integer
cansNeeded = gallonsPaintNeeded / gallonsPerCan; //Hint: this line is missing two operations
System.out.println("Cans needed: " + cansNeeded + " can(s)");

return;
}}

Reference no: EM132106379

Questions Cloud

Program for developing non-verbal communication skills : 60 children, ages 3-5, are selected to participate in a program for developing non-verbal communication skills. The children were selected on the basis
Create list function to create the list with the integers : The main program will demonstrate that the functions work. Input: An input file contains an unknown number of integers.
Concerns or considerations for interpreting results : What are the special concerns or considerations for interpreting results when the dependent variable is a physiological measure
What is the us versus them mentality : What is the "Us Versus Them" mentality, including the concepts of in-group bias and out-group homogeneity?
Calculate and output the walls area : Prompt the user to input a wall's height and width. Calculate and output the wall's area.
Person suffering from addiction play : What if any part does a family or friend play in a person suffering from addiction play in that person getting clean? Being so close to the situation you would
Most people would readily argue for the ability : Most people would readily argue for the ability to live in a free society in which they are allowed to do as they desire, but what happens when one's choices
What is the exection time on the new process : The program currently spends 30% of its execution time on executing floating point instructions.
Hilton confessed to killing 7 people : Hilton confessed to killing 7 people. He stated that he didn't care about those people; he told the police that he is indifferent and he did not

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd