Question

In: Computer Science

(must be done in JAVA code) A company dedicated to parking management has decided to renew...

(must be done in JAVA code)

A company dedicated to parking management has decided to renew itself by automating its control process since this process is done manually. The company has hired its development team to automate the process and gave it an October 19th deadline until 6 pm. An analyst defined the system requirements as follows:

1. The system must allow configuring the number of spaces that a vehicle parking lot will contain.

2. The system must allow the person in charge (normally a security person) to consult the available spaces to be able to indicate to the arriving users where to park.

3. The system must allow the person in charge (normally a security person) to enter the space where they will park, the license plate, brand, color and commercial value of the vehicle to be parked. In some cases, the person in charge may omit the commercial value of the vehicle due to ignorance, for these cases a default value of 30 million will be saved.

4. The system must allow the status of all the spaces in the building to be consulted.

5. The system must allow printing all the information of the parked vehicles.

6. The system must allow consulting the information of a parked vehicle.

7. The system must be able to change the sensor status (available to occupied) when a car occupies a parking space.

Solutions

Expert Solution

Hope this will help you, Please Thumbs Up , Thanks in advance!

*************************************************************************

Vehicle.java


public class Vehicle {
private int vehicleId;
private String brand;
private String color;
private int vehicleValue=10;
public String getBrand() {
   return brand;
}

public int getVehicleId() {
   return vehicleId;
}

public void setVehicleId(int vehicleId) {
   this.vehicleId = vehicleId;
}

public void setBrand(String brand) {
   this.brand = brand;
}
public String getColor() {
   return color;
}
public void setColor(String color) {
   this.color = color;
}
public int getVehicleValue() {
   return vehicleValue;
}
public void setVehicleValue(int vehicleValue) {
   this.vehicleValue = vehicleValue;
}
public Vehicle(String brand, String color, int vehicleValue,int vehickeId) {
   super();
   this.brand = brand;
   this.color = color;
   this.vehicleValue = vehicleValue;
   this.vehicleId=vehickeId;
}

@Override
public String toString() {
   return "Vehicle [vehicleId=" + vehicleId + ", brand=" + brand + ", color=" + color + ", vehicleValue="
           + vehicleValue + "]";
}


}
************************************************************************

ParkingSlot.java


public class ParkingSlot {
private int slotId;
private String slotStatus="A"; //status =A means slot available and status=NA means slot not available
private Vehicle vehicle;
public int getSlotId() {
   return slotId;
}
public void setSlotId(int slotId) {
   this.slotId = slotId;
}
public String getSlotStatus() {
   return slotStatus;
}
public void setSlotStatus(String slotStatus) {
   this.slotStatus = slotStatus;
}
public Vehicle getV() {
   return vehicle;
}
public void setV(Vehicle v) {
   this.vehicle = v;
}


}
********************************************************************

Parking.java


public class Parking {
private ParkingSlot[] AllSlots=new ParkingSlot[10]; //configuring number of slots that parking will contain to 10

public Parking()
{
   for(int i=0;i<10;i++)
   {
       ParkingSlot ps=new ParkingSlot();
       ps.setSlotId(i);
       ps.setSlotStatus("Available");
       ps.setV(null);
       AllSlots[i]=ps;
   }
}
public void ViewAllParkingSlots()
{
   System.out.println("Status of slots availability");
   for(int i=0;i<10 ;i++)
   {
       System.out.println(AllSlots[i].getSlotId()+"--->"+AllSlots[i].getSlotStatus());
   }
}
public void ViewOccupiedParkingSlots()
{
  
  
   for(int i=0;i<10;i++)
   {
       if(AllSlots[i].getV()!=null && AllSlots[i].getSlotStatus().equalsIgnoreCase("Occupied") )
       {
           System.out.println("slot id"+AllSlots[i].getSlotId());
           System.out.println("vehicle informtion:");
           System.out.println("Vehicle id:"+AllSlots[i].getV().getVehicleId());
           System.out.println("Vehicle Brand:"+AllSlots[i].getV().getBrand());
           System.out.println("Vehicle Color:"+AllSlots[i].getV().getColor());
           System.out.println("Vehicle Value in million:"+AllSlots[i].getV().getVehicleValue());
       }
   }
}
public void ParkVehicle(Vehicle v,int slotId)
{
   AllSlots[slotId].setSlotStatus("Occupied");
   AllSlots[slotId].setV(v);
}
}
************************************************************************

Test.java

import java.util.*;
import java.io.*;
public class Test {

   public static void main(String[] args) {
       // TODO Auto-generated method stub
       int WantToPark =0;
       Scanner sc=new Scanner(System.in);
       Parking p=new Parking();
       System.out.println("***********************************************");
       p.ViewAllParkingSlots();
       System.out.println("***********************************************");
       do
       {
           System.out.println("Do you want to park vehicle if yes please enter 1 else 0");
           WantToPark=sc.nextInt();
          
       if(WantToPark==1)
       {
       System.out.println("Please select slot and enter slot id:");
      
       int sid=sc.nextInt();
      
      
       System.out.println("Please Vehicle details...");
      
       System.out.println("Enter vehicle id:");
       int vid=sc.nextInt();
       sc.nextLine();
       System.out.println("Enter vehicle brand:");
       String brand=sc.nextLine();
       System.out.println("Enter vehicle color:");
       String color=sc.nextLine();
       System.out.println("Enter vehicle values:");
       int value=sc.nextInt();
       Vehicle v=new Vehicle(brand, color,value, vid);
      
       p.ParkVehicle(v,sid);
       System.out.println("***********************************************");
       System.out.println("All slots of parking");
       p.ViewAllParkingSlots();
       System.out.println("***********************************************");
       System.out.println("Occupied slots of parking");
       p.ViewOccupiedParkingSlots();
       System.out.println("***********************************************");
      
       }
       }while(WantToPark==1);
      
   }
}
*****************************************************************************S

Screen shot of output


Related Solutions

The lease of Theme Park, Inc., is about to expire. Management must decide whether to renew...
The lease of Theme Park, Inc., is about to expire. Management must decide whether to renew the lease for another 10 years or to relocate near the site of a proposed motel. The town planning board is currently debating the merits of granting approval to the motel. A consultant has estimated the net present value of Theme Park’s two alternatives under each state of nature as shown below. Suppose that the management of Theme Park, Inc., has decided that there...
This program must be done in JAVA. Write a program to monitor the flow of an...
This program must be done in JAVA. Write a program to monitor the flow of an item into an out of a warehouse. The warehouse has numerous deliveries and shipments for this item (a widget) during the time period covered. A shipment out (an order) is billed at a profit of 50% over the cost of the widget. Unfortunately each incoming shipment may have a different cost associated with it. The accountants of the firm have instituted a last-in, first...
Java code for creating an Inventory Management System of any company - designing the data structure(stack,...
Java code for creating an Inventory Management System of any company - designing the data structure(stack, queue, list, sort list, array, array list or linked list) (be flexible for future company growth Java code for creating an initial list in a structure. Use Array (or ArrayList) or Linkedlist structure whichever you are confident to use. - Implement Stack, Queue, List type structure and proper operation for your application. Do not use any database. All data must use your data structures....
Must be done in Java. In the 1980s HP produced postfix calculators, which enabled people to...
Must be done in Java. In the 1980s HP produced postfix calculators, which enabled people to perform arithmetic calculations without using parentheses. The problem was that we had to first learn how to convert a "normal" arithmetic expression (known as an infix expression) to postfix before we could use the calculator. Then the calculator uses a stack to evaluate the expression . The following tutorial shows you how to use a stack to calculate the result of a postfix expression...
Must be done in Java. In the 1980s HP produced postfix calculators, which enabled people to...
Must be done in Java. In the 1980s HP produced postfix calculators, which enabled people to perform arithmetic calculations without using parentheses. The problem was that we had to first learn how to convert a "normal" arithmetic expression (known as an infix expression) to postfix before we could use the calculator. Then the calculator uses a stack to evaluate the expression . The following tutorial shows you how to use a stack to calculate the result of a postfix expression...
How Heapify is done (theory, pseudocode, and examples) the examples used Java code please (in your...
How Heapify is done (theory, pseudocode, and examples) the examples used Java code please (in your own words)
needs to be done in C++ Q6. Coding Question (you must code this problem and submit...
needs to be done in C++ Q6. Coding Question (you must code this problem and submit via Blackboard): Keep everything as Integers. Row and Column Numbering starts at 1. Equation for each Cell :   Coll = (Row * Col * 10) Using Nested Loops display the following exactly as it is shown below:                                  Columns % Brand         1           2         3          4               A            10         20       30       40          B            20         40        60       80           C            30         60        90    ...
Answer as soon as possible!!! Code must be done with Python Develop a basic File Transfer...
Answer as soon as possible!!! Code must be done with Python Develop a basic File Transfer Protocol (FTP) application that transmits files between a client and a server using Python. Your programs should implement four FTP commands: (1) change directory (cd), (2) list directory content (ls), (3) copy a file from client to a server (put) and (4) copy a file from a server to a client (get). Implement two versions of the program: one that uses stock TCP for...
In JAVA Directions: You must trace through the code and determine the status of the array....
In JAVA Directions: You must trace through the code and determine the status of the array. The code can be found on the second page of this packet. Assume Array A = Index 0 1 2 3 4 5 6 7 8 9 10 11 12 Value 33 12 39 6 -2 30 15 11 55 100 40 39 1 How many elements does A have? ______________ What is the start index? _______________ (assume this value is stored in a...
***This problem must be done using R so please provide the R code used to find...
***This problem must be done using R so please provide the R code used to find the solution. I have provided the data in data-wtLoss.txt below the question. I will also give "thumbs-up for correct R code" Thanks in advance.*** The file “data-wtLoss.txt” contains data on weight loss and self esteem evaluation at three time points over a period of three months for 34 individuals who are randomly selected from a residential area. These individuals are randomly assigned to one...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT