Question: JAVA Write a method to delete the details of a device specified by the user. The method should provide feedback stating whether a record is

JAVA

Write a method to delete the details of a device specified by the user. The method should provide feedback stating whether a record is deleted or not using the source code below.

public class Device {

private static List list;

private static String MAC;

private String make;

private String model;

public Device(String MAC, String make, String model) {

this.MAC = MAC;

this.make = make;

this.model = model;

}

public String getMAC() {

return MAC;

}

public String getMake() {

return make;

}

public String getModel() {

return model;

}

public static void displayDetails(List list) { System.out.println("Devices : "); // Iterate through all the Devices in the list and print the details for (Device d : list) { System.out.println(d.getMAC() + " " + d.getMake() + " " + d.getModel()); } }

public static void main(String[] args) { ArrayList list = new ArrayList(); Scanner obj = new Scanner(System.in); for (int i = 0; i < 5; i++) { System.out.println("Enter MAC"); String mac = obj.next(); System.out.println("Enter make"); String make = obj.next(); System.out.println("Enter model"); String model = obj.next(); Device d = new Device(mac, make, model); list.add(d); } displayDetails(list);

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!