Results 1 to 4 of 4
  1. #1
    pavez is offline Member
    Join Date
    Aug 2009
    Posts
    3
    Rep Power
    0

    Default Help needed very simple java program

    hi there,

    i have recently started to learn java. and i have been given these simple java programs to get started with.
    could and one give me any idea on how to solve these programs as they have blown my head away.

    Write a program Wallcover_estimate.
    This program must contain at least two methods (main and one or more other method(s)).
    Write a method that calculates the wall area of a room. It should take three parameters the width, length and height of a room. This method must then calculate the wall area and output the result to the screen.

    The method should be called repeatedly from main until the user indicates that they wish to stop calculating room wall areas.

    (Area of wall covering = (2*(length * height)) + (2* (width * height)).

    if any one could solve and guide me through this. i would really appritiate any response and advise given.
    thanks

  2. #2
    RamyaSivakanth's Avatar
    RamyaSivakanth is offline Senior Member
    Join Date
    Apr 2009
    Location
    Chennai
    Posts
    841
    Rep Power
    6

    Default

    Hi,
    We can write and give u.It will not be a problem.First,U need to learn.
    Write a code from ur end and we will give hand if u get stuck up.

    -Regards
    Ramya
    Ramya:cool:

  3. #3
    pavez is offline Member
    Join Date
    Aug 2009
    Posts
    3
    Rep Power
    0

    Default

    thanks very much on ur advise. and i will submit what i have manged to do so far.
    thanks alot

  4. #4
    pavez is offline Member
    Join Date
    Aug 2009
    Posts
    3
    Rep Power
    0

    Default simple java program, please help!!

    this is the work which i have done so far.
    thanks alot


    // calculating area of wall covering of a room

    import javax.swing.JOptionPane;

    public class Room
    {
    // First Method, to find Area of room to be covered
    public static void areaOfRoom(double lenght, double height, double width)
    {
    double area = 2 * (lenght * height) + 2 * (width * height);


    if (lenght<0)
    JOptionPane.showMessageDialog(null, "Lenght Can not be negative");
    if (height<0)
    JOptionPane.showMessageDialog(null, "Height Can not be negative");
    if (width<0)
    JOptionPane.showMessageDialog(null, "Width Can not be negative");
    if (lenght>0)
    if (height>0)
    if (Width>0)
    JOptionPane.showMessageDialog(null, "The Area of Rectangle is " + area);
    }

    // Main Method to input numbers from the user
    public static void main(String[]args)
    {
    String input = JOptionPane.showInputDialog("Please Type in 1 to find the Area of Room");
    int number = Integer.parseInt(input);
    int count=0;
    double l,h + w,h;

    // This Section runs the areaOfRectangle Method
    if (number==1)
    {
    input = JOptionPane.showInputDialog("Please Type in the Lenght of the Room");
    l = Integer.parseInt(input);
    input = JOptionPane.showInputDialog("Please Type in the Height of the Room");
    h = Integer.parseInt(input);
    input = JOptionPane.showInputDialog("Please Type in the Width of the Room");
    W = Integer.parseInt(input);
    areaOfRectangle 2 * (l, h) + 2 * (W, h);

    else if (number<0) // Terminates the program
    {
    }
    }
    }

Similar Threads

  1. [SOLVED] Need help with simple Java program
    By hungdukie in forum New To Java
    Replies: 5
    Last Post: 11-26-2008, 03:17 AM
  2. Simple Java probablitity program?
    By nothing4me in forum New To Java
    Replies: 6
    Last Post: 11-12-2008, 06:16 AM
  3. the explanation of output of simple java program
    By amol84 in forum New To Java
    Replies: 1
    Last Post: 11-06-2008, 05:06 PM
  4. help with simple program in java
    By katie in forum New To Java
    Replies: 2
    Last Post: 08-06-2007, 08:03 PM
  5. help with simple java program
    By leonard in forum New To Java
    Replies: 3
    Last Post: 07-30-2007, 09:40 AM

Tags for this Thread

Posting Permissions

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