logotransparent.png

Legion of Learners

www.lol-101.com

  • Home

  • Classrooms

  • Courses

  • About Us

    • Executive Team
    • Board Members
  • Resources

  • More

    Use tab to navigate through the menu items.
    To see this working, head to your live site.
    • Categories
    • All Posts
    • My Posts
    kevinzhao183
    Jun 21, 2020

    Intro to Java 6/20 Homework

    in Java Question Bank

    For your homework, write a program that computes the surface area of a cylinder. Your program should read in the height of the cylinder and radius of the base, and it should both compute and output the surface area of the cylinder (being as exact as possible). Comment your solution here.

    9 comments
    0
    jonathan.cheng.2004
    Jun 21, 2020

    class Main { public static void main(String[] args) { double h = 3.5; double r = 4.0; double s = 2 * r * r * Math.PI + 2 * Math.PI * r * h; System.out.println(s); } }

    0
    afefe2007
    Jun 22, 2020

    import java.util.Scanner; class Main { public static void main(String[] args) { System.out.println(" Please enter the radius of the cylinder. " ); Scanner sc = new Scanner(System.in); float radius = sc.nextFloat(); System.out.println(" Please enter the height of the cylinder. " ); float height = sc.nextFloat(); double area = 2 * radius * radius *Math.PI + 2 * radius *Math.PI * height; System.out.println(" The Surface Area is ..." ); System.out.println(area); } }

    0
    Eric Wu
    Jun 22, 2020

    import java.util.Scanner; class Main { public static void main(String[] args) { System.out.println("enter the radius" ); Scanner sc = new Scanner(System.in); float r = sc.nextFloat(); System.out.println("enter the height" ); float h = sc.nextFloat(); double sa = 2 * r * r *Math.PI + 2 * r *Math.PI * h; System.out.println(" The Surface Area is " + sa ); } }

    0
    leosong23
    Jun 24, 2020

    package Intro_to_Java_Class_6;

    import java.util.Scanner;

    public class Intro_to_Java_Class3_6_20 {

    public Intro_to_Java_Class3_6_20() {

    // TODO Auto-generated constructor stub

    }

    public static void main(String[] args) {

    // TODO Auto-generated method stub

    Scanner in = new Scanner(System.in);

    System.out.print("Height: ");

    String in_h = in.next();

    double h = Double.parseDouble(in_h);

    Scanner in2 = new Scanner(System.in);

    System.out.print("Radius: ");

    String in_r = in.next();

    System.out.print("");

    double r = Double.parseDouble(in_r);

    double C = 2*Math.PI*r;

    double body = C*h;

    double caps = 2*Math.PI*r*r;

    double final_sa = caps + body;

    System.out.print(final_sa);

    }

    }


    0
    emiiilee2.0
    Jun 24, 2020

    class Main { public static void main(String[] args) { double r = 3.0; double h = 4.5; double sa = 2 * Math.PI * r * h + 2 * (Math.PI * r * r); System.out.println(sa); } }

    0
    ivanyu521
    Jun 24, 2020

    class Main { public static void main(String[] args) {


    double h = 1.5; double r = 6.0; double s = 2 * r * h * Math.PI + 2 * Math.PI * r * r; System.out.print(s); } }

    0
    andymei2007
    Jun 24, 2020

    class Main { public static void main(String[] args) { double h = 6.0; double r = 2.5; double c = Math.PI * 2 * r; double a = Math.PI * Math.pow(r, 2); double s = 2 * a + c*h; System.out.println("The surface area is: " + s); } }

    0
    nathanshimizu2016
    Jun 24, 2020

    class Main { public static void main(String[] args) { double h = 7.5; double r = 8; double sa = Math.PI * h * r * 2 + Math.PI * 2 * r * r; System.out.println(sa); } }

    0
    xunzhu0711
    Dec 19, 2020

    class Main {

    public static void main(String[] args) {

    double h = 7.5;

    double r = 8;

    double sa = Math.PI * h * r * 2 + Math.PI * 2 * r * r;

    System.out.println(sa); }


    }

    0
    9 comments

    Questions? Email us at legionoflearners@gmail.com or join our WeChat group!