SophiaPretty

(5)

$14/per page/Negotiable

About SophiaPretty

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Applied Sciences,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Economics,Engineering,English,Environmental science,Essay writing Hide all
Teaching Since: Jul 2017
Last Sign in: 305 Weeks Ago
Questions Answered: 15833
Tutorials Posted: 15827

Education

  • MBA,PHD, Juris Doctor
    Strayer,Devery,Harvard University
    Mar-1995 - Mar-2002

Experience

  • Manager Planning
    WalMart
    Mar-2001 - Feb-2009

Category > Computer Science Posted 14 Oct 2017 My Price 8.00

Below, there is a code that I have written.

Below, there is a code that I have written.

 

import java.util.Scanner;

import java.lang.Math;  // Note: Needed for math functions in part (3)

 

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 wallPaint;

   System.out.println("Enter wall height (feet):");

   wallHeight = scnr.nextDouble();

   System.out.println("Enter wall width (feet):");

   wallWidth = scnr.nextDouble();

   // Calculate and output wall area

   wallArea = (wallHeight * wallWidth);         

   System.out.println("Wall area: " + wallArea + " square feet");  

   // Calculate and output the amount of paint in gallons needed to paint the wall

   wallPaint = (wallArea / 350);

   System.out.println( "Paint needed: " + wallPaint + " gallons");

 

// Calculate and output the number of 1 gallon cans needed to paint the wall, rounded up to nearest integer

   System.out.println("Cans needed: " + Math.round( wallPaint) + " can(s)");

   return;

  }

}

However, I am trying to refactor it into this format:

 

/**

* Calculates the area of a wall.

*

* @param wallHeight The height of the wall.

* @param wallWidth The width of the wall.

* @return The area of the wall.

*/

public static double calcWallArea(double wallHeight, double wallWidth) {

// FILL IN BODY

}

 

/**

* Calculates the amount of paint in gallons required to paint a given area.

*

* @param area The area to paint in square feet.

* @param sqFtPerGallon The amount of coverage (in square feet) per gallon of

* paint.

* @return The amount of paint require in gallons.

*/

public static double calcGallonsPaintNeeded(double area, double sqFtPerGallon) {

// FILL IN BODY

}

 

/**

* Calculates the minimum number of cans needed for a given volume of paint.

*

* @param volPerCan Volume of paint in a single can.

* @param volPaintNeeded Total volume of paint required.

* @return Minimum number of cans needed for the given volume of paint.

*/

public static int minNumberOfCans(double volPerCan, double volPaintNeeded) {

// FILL IN BODY

}

 

 

 

This creates several methods and I am not sure how to change it to this way.

Answers

(5)
Status NEW Posted 14 Oct 2017 07:10 AM My Price 8.00

-----------  ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly

Not Rated(0)