Results 1 to 6 of 6
  1. #1
    samwright92 is offline Member
    Join Date
    Nov 2012
    Posts
    3
    Rep Power
    0

    Default i need help with assignment

    Objective of the assignment
    The objective of the assignment is to develop your understanding of how to use two-dimensional arrays in a practical problem.

    Assignment
    Topic of assignment: Simulated vacuum cleaner
    Write a program for an intelligent vacuum cleaner. Given a rectangular room with a square obstacle in the center, please write a program that can navigate the cleaner to move around and clean the entire room in a straight line pattern.
    The project will be used as a base of sequential projects in this class. You will have related projects in the File/Image class, and GUI programming.

    Problem representation:
    Room: represented with two-dimensional array of known size
    Space: represent with pixels or array elements
    Obstacle: side length is known and pixels are represented with a specific value

    Problem analysis
    You will design a main method and a clean method. Please be reminded that a vacuum CANNOT jump over an obstacle.
    main method: get inputs from the console; create an initial room map
    clean method: produce output which include a navigation signal sent to the moving part and a clean signal sent to the cleaning part (simulate them by printing texts on the console)
    Input: room size, and obstacle location
    Output: a sequence of cleaning path

    A running example:
    Room size: 5 7
    Obstacle’s start position: 3 3
    Obstacle’s side length: 2

    Clean; Move to right
    Clean, Move to right
    Clean, Move to right
    Clean, Move to right
    Clean, Move to right
    Clean, Move to right
    Clean, Move down
    Clean, Move left
    …….
    Outcome

    This is extra credit that i really need to pass this class

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,184
    Rep Power
    19

    Default Re: i need help with assignment

    Quote Originally Posted by samwright92 View Post
    i really need to pass this class
    If your capabilities are limited to dumping your assignment on a public forum, do you think you deserve to pass?

    Recommended reading: How to ask questions the smart way

    Post your best efforts and indicate where you're stuck and you'll surely get help.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    Darkzombies is offline Senior Member
    Join Date
    Nov 2012
    Posts
    105
    Rep Power
    0

    Default Re: i need help with assignment

    This forum doesn't do your work for you. The moderators will probably tell you the same thing.

  4. #4
    kshamagupta27 is offline Member
    Join Date
    Nov 2012
    Posts
    1
    Rep Power
    0

    Default Re: i need help with assignment

    can you send your request to <email address removed to protect the innocent -mod>
    Last edited by JosAH; 11-27-2012 at 10:35 AM.

  5. #5
    samwright92 is offline Member
    Join Date
    Nov 2012
    Posts
    3
    Rep Power
    0

    Default Re: i need help with assignment

    Run and compiles fine, just want someones opinion before i submit.



    import java.util.Scanner;

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

    //Create a Scanner
    Scanner input = new Scanner(System.in);
    int k1;// a
    int k2;// b
    int k3;
    int k4;
    int k5;

    System.out.println("Please enter a width"); // prompt
    k1 = input.nextInt();// reads first input
    System.out.println("Please enter a length"); // prompt
    k2 = input.nextInt();// reads second input
    System.out.println("Please enter the row location of the obstacle");
    k3 = input.nextInt();
    System.out.println("Please enter the column location of the obstacle");
    k4 = input.nextInt();
    System.out.println("Please enter the size of the obstacle");
    k5 = input.nextInt();

    //Input usage scanner
    int r = k1;
    int c = k2;
    int s = k3;
    int y = k4;
    int a = k5;

    //Create a matrix
    int[][] room = new int[k1][k2];

    //Create a way for the vacuum to move around
    for (int row = 0; row < room.length; row++) {
    for (int col = 0; col < room[row].length; col++){
    if (row >= col) {
    if (col <= room.length)
    System.out.println("Clean, move to the right");
    }
    else if (col == room.length - 1)
    System.out.println("Clean, move up");
    else if (row <= col)
    System.out.println("Clean, move left");
    if (row == col){
    System.out.println("Clean, move down");
    }
    }
    }
    }
    }

  6. #6
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,184
    Rep Power
    19

    Default Re: i need help with assignment

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Help with assignment
    By mehnihma in forum New To Java
    Replies: 1
    Last Post: 09-18-2011, 03:06 AM
  2. I need help with an assignment
    By newarcher in forum New To Java
    Replies: 12
    Last Post: 09-08-2011, 01:09 PM
  3. Need Help with assignment - Willing to Pay!
    By BlackBalloon in forum NetBeans
    Replies: 2
    Last Post: 08-29-2011, 05:04 AM
  4. Need help with a HW assignment
    By mackavelirip in forum New To Java
    Replies: 4
    Last Post: 02-17-2011, 01:36 AM
  5. Assignment
    By shinkymar in forum New To Java
    Replies: 2
    Last Post: 03-06-2010, 01:17 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
  •