Please help me figure out what I am doing wrong.... =[ 2.20 Debugging: Painting a wall (Java) Instructor notes (1) Prompt the user to input a wall's height and width. Calculate and output the wall's...



Please help me figure out what I am doing wrong.... =[


2.20 Debugging: Painting a wall (Java)


Instructor notes


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


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. (Submit for 1 points, so 3 points total).


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. (Submit for 2 points, so 5 points total).


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







1. Compare output


0/2

















Input

12 15


Your output starts with

Exception in thread "main" java.lang.NoClassDefFoundError: PaintEstimator (wrong name: paintestimator/PaintEstimator) at java.lang.ClassLoader.defineClass1(


Expected output starts with

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



2. Compare output


0/1

















Input

12 15


Your output starts with

Exception in thread "main" java.lang.NoClassDefFoundError: PaintEstimator (wrong name: paintestimator/PaintEstimator) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.jav


Expected output starts with

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



3. Compare output


0/1

















Input

12 15


Your output

Exception in thread "main" java.lang.NoClassDefFoundError: PaintEstimator (wrong name: paintestimator/PaintEstimator) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:803) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:442) at java.net.URLClassLoader.access$100(URLClassLoader.java:64) at java.net.URLClassLoader$1.run(URLClassLoader.java:354) at java.net.URLClassLoader$1.run(URLClassLoader.java:348) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:347) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)


Expected output

Enter wall height (feet): Enter wall width (feet): Wall area: 180.0 square feet Paint needed: 0.5142857142857142 gallons Cans needed: 1 can(s)



4. Compare output


0/1

















Input

20 50


Your output

Exception in thread "main" java.lang.NoClassDefFoundError: PaintEstimator (wrong name: paintestimator/PaintEstimator) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:803) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:442) at java.net.URLClassLoader.access$100(URLClassLoader.java:64) at java.net.URLClassLoader$1.run(URLClassLoader.java:354) at java.net.URLClassLoader$1.run(URLClassLoader.java:348) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:347) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)


Expected output

Enter wall height (feet): Enter wall width (feet): Wall area: 1000.0 square feet Paint needed: 2.857142857142857 gallons Cans needed: 3 can(s)


code I am using...


import java.util.Scanner; import java.lang.Math; // Note: Needed for math functions public class PaintEstimator {


public static void main(String[] args) {    //Scanner class object is used to read the inputs entered by the user Scanner scnr=new Scanner(System.in);    //Declaring variables double height,width,area,paint_needed;       //Declaring constant final double one_gallon_covers=350;       //Getting the height entered by the user System.out.print("Enter wall height (feet):"); height=scnr.nextDouble();       //Getting the width entered by the user System.out.print("Enter wall width (feet):"); width=scnr.nextDouble();       //calculating the area of the wall area=width*height;       //1.Displaying the area of the wall System.out.println("Wall area: "+area+" square feet");       //calculating the paint need to paint the area of the wall (In gallons) paint_needed=area/one_gallon_covers;       //2.Displaying the no of gallons of paint needed to paint the wall System.out.println("Paint needed: "+paint_needed+" gallons");       //3.Rounding the required gallons of paint to paint the wall System.out.println("Cans needed: "+Math.round(paint_needed)+" can(s)");


return; } }




Nov 11, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here