Results 1 to 2 of 2
  1. #1
    joshsmith3400 is offline Member
    Join Date
    Feb 2011
    Posts
    2
    Rep Power
    0

    Default help with another code

    here is another problem I am having trouble with...

    Crackers

    You are helping a cracker company determine how many crackers will fit into a box. The crackers are round (Ritz?) and will be stacked in cylindrical tubes. You may also assume that there will only be one layer of crackers in the box (several tubes, side by side).

    Ask the user for the radius of a cracker, the thickness of a cracker, the height of the box, and the width of the box. From this information, display for the user the number of crackers that can fit in a box.


    HERE IS THE CODE I HAVE SO FAR... ANY HELP WOULD BE AWESOME! I am completely wrong in most of the parts i think but idk where to go with what i have

    import java.util.Scanner;




    public class Cracker {


    public static void main(String[] args) {




    Scanner sc = new Scanner(System.in);
    System.out.println("What is the radius of your cracker in inches? ");
    int radius = sc.nextInt();
    radius = sc.nextInt();

    Scanner sc1 = new Scanner(System.in);
    System.out.println("How thick is your cracker in inches? ");
    int thickness = sc1.nextInt();
    thickness = sc.nextInt();



    Scanner sc2 = new Scanner(System.in);
    System.out.println("What is the height of the box (in inches)? ");
    int height = sc2.nextInt();
    height = sc.nextInt();


    Scanner sc3 = new Scanner(System.in);
    System.out.println("What is the width of the box (in inches)? ");
    int width = sc3.nextInt();
    width = sc.nextInt();


    System.out.println (radius + ", " + thickness + ", " + height + ", " + width);

    }



    }

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,404
    Rep Power
    20

    Default

    1. Wrong forum, the lobby isn't for technical questions.
    2. When you re-post this in a correct forum, ask a specific question. Recommended reading: How To Ask Questions The Smart Way

    db

Similar Threads

  1. Code to check if a piece of code is legal.
    By vahshir in forum New To Java
    Replies: 3
    Last Post: 08-30-2010, 04:21 AM
  2. Replies: 1
    Last Post: 03-04-2010, 11:19 AM
  3. Convert java code to midlet code
    By coldvoice05 in forum New To Java
    Replies: 1
    Last Post: 08-12-2009, 11:14 AM
  4. Convert java code to midlet code
    By coldvoice05 in forum Advanced Java
    Replies: 1
    Last Post: 08-09-2009, 01:21 PM
  5. Replies: 1
    Last Post: 04-26-2007, 03:52 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •