Enter x Coordinate: 1 Enter Y Coordinate: 1 Enter Length: 5 *************** Options 1. Clear Level 2. Add Platform 3. Add Items 4. Quit Enter a choice: 3 [Add Item] Enter x coordinate: 30 Enter Y Coordinate: 30 This is not a valid location! ****** ********** Options 1. Clear Level 2. Add Platform 3. Add Items 4. Quit Enter a choice: 3 [Add Item] Enter x Coordinate: 3 Enter Y Coordinate: 0 ***0**************** ******

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

in java please

 

**Platform and Item Management System**

In this simulation, users can manage platforms and items by selecting specific coordinates on a grid. The system provides different functionalities, such as adding platforms and items, clearing the level, or quitting the program. Below are transcribed steps showing user interaction with the system:

1. **Add Platform:**
   - Enter X Coordinate: **1**
   - Enter Y Coordinate: **1**
   - Enter Length: **5**

   A platform is added starting at coordinates (1,1) with a length of 5 units.

   ```
   ****************
   *=====**********
   ****************
   ****************
   ****************
   ****************
   ```

2. **User Options:**
   - 1. Clear Level
   - 2. Add Platform
   - 3. Add Items
   - 4. Quit
   - Enter a choice: **3**

3. **Add Item:**
   - Enter X Coordinate: **30**
   - Enter Y Coordinate: **30**

   The attempt to add an item fails because the location is invalid; it's outside the defined grid boundaries.

4. **User Options:**
   - 1. Clear Level
   - 2. Add Platform
   - 3. Add Items
   - 4. Quit
   - Enter a choice: **3**

5. **Add Item:**
   - Enter X Coordinate: **3**
   - Enter Y Coordinate: **0**

   An item is successfully added at these coordinates. The grid now reflects this addition:

   ```
   ***O************
   *=====**********
   ****************
   ****************
   ****************
   ****************
   ```

**Explanation of Grid:**

- The grid is organizationally consistent, assisting users in easily visualizing platform and item locations. 
- `*` represents empty spaces on the grid.
- `=` indicates the space occupied by the newly added platform.
- `O` marks the location where an item has been successfully placed. 

This user-guided process provides flexibility in designing a custom layout by adding or removing platforms and items as desired.
Transcribed Image Text:**Platform and Item Management System** In this simulation, users can manage platforms and items by selecting specific coordinates on a grid. The system provides different functionalities, such as adding platforms and items, clearing the level, or quitting the program. Below are transcribed steps showing user interaction with the system: 1. **Add Platform:** - Enter X Coordinate: **1** - Enter Y Coordinate: **1** - Enter Length: **5** A platform is added starting at coordinates (1,1) with a length of 5 units. ``` **************** *=====********** **************** **************** **************** **************** ``` 2. **User Options:** - 1. Clear Level - 2. Add Platform - 3. Add Items - 4. Quit - Enter a choice: **3** 3. **Add Item:** - Enter X Coordinate: **30** - Enter Y Coordinate: **30** The attempt to add an item fails because the location is invalid; it's outside the defined grid boundaries. 4. **User Options:** - 1. Clear Level - 2. Add Platform - 3. Add Items - 4. Quit - Enter a choice: **3** 5. **Add Item:** - Enter X Coordinate: **3** - Enter Y Coordinate: **0** An item is successfully added at these coordinates. The grid now reflects this addition: ``` ***O************ *=====********** **************** **************** **************** **************** ``` **Explanation of Grid:** - The grid is organizationally consistent, assisting users in easily visualizing platform and item locations. - `*` represents empty spaces on the grid. - `=` indicates the space occupied by the newly added platform. - `O` marks the location where an item has been successfully placed. This user-guided process provides flexibility in designing a custom layout by adding or removing platforms and items as desired.
Certainly! Here’s the transcription of the text as it would appear on an educational website:

---

**Level Editor Interface**

```
********************
*====***************
********************
********************
********************
********************

Options
1. Clear Level
2. Add Platform
3. Add Items
4. Quit
Enter a choice: 3

[Add Item]
Enter X Coordinate: 30
Enter Y Coordinate: 30
This is not a valid location!
********************
********************
********************
********************
********************

Options
1. Clear Level
2. Add Platform
3. Add Items
4. Quit
Enter a choice: 3

[Add Item]
Enter X Coordinate: 3
Enter Y Coordinate: 0
***O****************
********************
********************
********************
********************

Options
1. Clear Level
2. Add Platform
3. Add Items
4. Quit
Enter a choice: 2
```

**Explanation of the Interface:**

This text depicts a level editor interface for a simple game or simulation. The user interacts with the program by selecting options and entering coordinates to place items within a grid-based level.

1. **Initial Layout:**
   - The grid is visually represented with asterisks (`*`) and other symbols. The section marked with `====` indicates the presence of a platform.

2. **Options Menu:**
   - The user is presented with four options:
     1. **Clear Level:** Removes all items and platforms from the grid.
     2. **Add Platform:** Allows the user to place a platform on the grid.
     3. **Add Items:** Enables item placement within specified coordinates.
     4. **Quit:** Exits the editor.

3. **Adding Items:**
   - The user attempts to add an item by specifying `X` and `Y` coordinates.
   - If an invalid location is chosen (as seen with coordinates `30, 30`), the program displays a message, "This is not a valid location!"

4. **Grid Changes:**
   - When a valid item placement is made (e.g., coordinates `3, 0`), changes are reflected in the grid with an `O` symbol indicating the item's position.

5. **Further Options:**
   - Users can continue to select different options and modify the grid as needed.

This interface is a simple representation of how basic level editors function, demonstrating user interaction through
Transcribed Image Text:Certainly! Here’s the transcription of the text as it would appear on an educational website: --- **Level Editor Interface** ``` ******************** *====*************** ******************** ******************** ******************** ******************** Options 1. Clear Level 2. Add Platform 3. Add Items 4. Quit Enter a choice: 3 [Add Item] Enter X Coordinate: 30 Enter Y Coordinate: 30 This is not a valid location! ******************** ******************** ******************** ******************** ******************** Options 1. Clear Level 2. Add Platform 3. Add Items 4. Quit Enter a choice: 3 [Add Item] Enter X Coordinate: 3 Enter Y Coordinate: 0 ***O**************** ******************** ******************** ******************** ******************** Options 1. Clear Level 2. Add Platform 3. Add Items 4. Quit Enter a choice: 2 ``` **Explanation of the Interface:** This text depicts a level editor interface for a simple game or simulation. The user interacts with the program by selecting options and entering coordinates to place items within a grid-based level. 1. **Initial Layout:** - The grid is visually represented with asterisks (`*`) and other symbols. The section marked with `====` indicates the presence of a platform. 2. **Options Menu:** - The user is presented with four options: 1. **Clear Level:** Removes all items and platforms from the grid. 2. **Add Platform:** Allows the user to place a platform on the grid. 3. **Add Items:** Enables item placement within specified coordinates. 4. **Quit:** Exits the editor. 3. **Adding Items:** - The user attempts to add an item by specifying `X` and `Y` coordinates. - If an invalid location is chosen (as seen with coordinates `30, 30`), the program displays a message, "This is not a valid location!" 4. **Grid Changes:** - When a valid item placement is made (e.g., coordinates `3, 0`), changes are reflected in the grid with an `O` symbol indicating the item's position. 5. **Further Options:** - Users can continue to select different options and modify the grid as needed. This interface is a simple representation of how basic level editors function, demonstrating user interaction through
Expert Solution
JAVA Program


import java.util.Scanner;
public class Main
{
 public static void main(String[] args) 
 {
     int r, c;
     int x,y,len;
     int m=1,ch;
     Scanner sc = new Scanner(System.in); 
     System.out.println("FYE Level Map Creater");
  
  System.out.print("Enter a level map width: ");
  c = sc.nextInt();
  System.out.print("Enter a level map height: ");
  r = sc.nextInt();
  
  String arr[][] = new String[r][c];
  for(int i=0;i<r;i++)
      for(int j=0;j<c;j++)
          arr[i][j] = "*";
  
  //Printing array
  for(int i=0;i<r;i++)
  {
      for(int j=0;j<c;j++)
          System.out.print(arr[i][j]);
      System.out.println();
  }
      
  
  do
  {
      System.out.println("\nOptions");
      System.out.println("1. Clear Level");
      System.out.println("2. Add Platform");
      System.out.println("3. Add Item");
      System.out.println("4. Quit");
      System.out.print("Enter Choice: ");
      ch = sc.nextInt();
      
      switch(ch)
      {
          case 1:
              for(int i=0;i<r;i++)
                  for(int j=0;j<c;j++)
                      arr[i][j] = "*";
              break;
          case 2:
              System.out.println("\n[Add Platform]");
              System.out.print("Enter X Coordinate: ");
              x = sc.nextInt();
              System.out.print("Enter Y Coordinate: ");
              y = sc.nextInt();
              System.out.print("Enter Length: ");
              len = sc.nextInt();
              
              if(len > c)
                  System.out.print("The platform is too long.\n");
              else
              {
                  for(int j=y; j<=len;j++)
                      arr[x][j] = "=";
              }
              break;
          case 3:
              System.out.println("\n[Add Item]");
              System.out.print("Enter X Coordinate: ");
              x = sc.nextInt();
              System.out.print("Enter Y Coordinate: ");
              y = sc.nextInt();
              if(x>r || y>c)
                  System.out.print("This is not a valid location!\n");
              else
                  arr[y][x] = "O";
              break;
          case 4:
              m=0;
              break;
      }
      //Printing array
      for(int i=0;i<r;i++)
      {
          for(int j=0;j<c;j++)
              System.out.print(arr[i][j]);
          System.out.println();
      }
  }while(m==1);
 }
}

steps

Step by step

Solved in 2 steps with 4 images

Blurred answer
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education