Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Consider a process of Information Security Audit that almost every organization

ID: 3807780 • Letter: C

Question

Consider a process of Information Security Audit that almost every organization has to pass from time to time. Part of the process is the assessment of assets from the perspective of security risk analysis. There are 3 security services: confidentiality, integrity, and availability and each of these services can be considered in the context of some application (software). For example, availability: every institution maintains academic records of all students. Such records are stored in a database, and this database is managed and accessed by means of DBMS (database management system) software, that in turn runs on some hardware server (asset). That server has many components, i.e. power supplies, NICs, HDD/SSDs, etc which may fail and their failure may cause failure of the server and therefore inability (failure of availability service) of users to access the application. Your task is to write a Java program that would represent an asset. Later on, you will be asked to extend this program and implement different types of assets as well as different types of applications and their relationship. As of now your program contain two classes: Asset Driver The former class, i.e. Asset, has to have the following attributes and methods: Your task is to write a Java program that would represent an asset. Later on, you will be asked to extend this program and implement different types of assets as well as different types of applications and their relationship. As of now your program contain two classes: Asset Driver The former class, i.e. Asset, has to have the following attributes and methods: String Type. Can be one of the following: Server, Switch, Router, PSU (power supply unit), HDD, SSD, NIC (network interface card) int ID A unique number that identify any given asset. String Name General description of the asset including (if needed) vendor, hardware, model, etc. String serial Serial number of the asset which is a combination of characters usually found on a sticker affixed on some surface of the asset int PID Parent ID -- ID of the asset that appears to be "parent" to this one. For example Server asset is the "parent" of NIC asset because NIC is plugged into the server. In case when asset has no parent, this value has to be set to -1. "Getters" and "setters" for all attributes Default constructor (one that takes no parameters and uses default values of attributes) Method String toString() that returns textual presentation of an asset object. Values of all attributes must be used in compilation of that string. The latter class, i.e. Driver is used to host main() method that would instantiate a few objects of class Asset (use some illustrative cases like 1 server, 1 switch, 2 PSUs, 3 NICs, etc) and store references to those objects in an array. Then it would iterate through the array and for every asset it would print result returned by toString() method.

Netbeans

Explanation / Answer

package myProject;
import java.util.*;

//Class Asset definition
class Asset
{
   //Instance variable
   String type;
   int ID;
   String name;
   String serialNumber;
   int PID;
   //Constructor
   Asset()
   {
       type = "";
       ID = 0;
       name = "";
       serialNumber = "";
       PID = 0;
   }
   //Returns type of asset
   String getType()
   {
       return type;
   }
   //Returns ID
   int getID()
   {
       return ID;
   }
   //Returns name
   String getName()
   {
       return name;
   }
   //Returns serialNumber
   String getSerialNumber()
   {
       return serialNumber;
   }
   //Returns parent ID
   int getPID()
   {
       return PID;
   }
   //Sets type of asset
   void setType(String t)
   {
       type = t;
   }
   //Sets ID
   void setID(int id)
   {
       ID = id;
   }
   //Sets name
   void setName(String n)
   {
       name = n;
   }
   //Sets serialNumber
   void setSerialNumber(String s)
   {
       serialNumber = s;
   }
   //Sets parent ID
   void setPID(int p)
   {
       PID = p;
   }
   //Overrides toString method
   public String toString()
   {
       String msg = "";
       msg += " Product Type: " + getType() + " Product ID: " + getID() + " Product Description: " + getName() +
               " Product Serial Number: " + getSerialNumber() + " Product Parent ID: " + getPID();
       return msg;
   }//End of method
}//End of class

//Driver class definition
public class DriverAsset
{
   //Main method
   public static void main(String ss[])
   {
       int val = 0, no = 0;
       //Scanner class object created to accept data
       Scanner sc = new Scanner(System.in);
       //Accepts number of products
       System.out.println("Enter how may product information you want to enter? ");
       no = sc.nextInt();
       //Creates array of assert objects
       Asset [] as = new Asset[no];
       //Loops till n
       for(int x = 0; x < no; x++)
       {
           as[x] = new Asset();
           System.out.println("Enter Assert " + (x + 1) + " information");
           System.out.println("Enter Product Type: ");
           as[x].setType(sc.next());
           System.out.println("Enter Product ID: ");
           as[x].setID(sc.nextInt());
           System.out.println("Enter Product Description: ");
           as[x].setName(sc.next());
           System.out.println("Enter Product Serial Number: ");
           as[x].setSerialNumber(sc.next());
           System.out.println("Enter Product Parent ID: ");
           as[x].setPID(sc.nextInt());
       }//End of for loop
       System.out.println("Product Information ");
       //Loops till n
       for(int x = 0; x < no; x++)
       {
           System.out.println("Assert " + (x + 1) + " information");
           System.out.println(as[x]);
       }//End of for loop
   }//End of main method
}//End of driver class

Output:

Enter how may product information you want to enter?
2
Enter Assert 1 information
Enter Product Type:
Server
Enter Product ID:
111
Enter Product Description:
Server
Enter Product Serial Number:
123456
Enter Product Parent ID:
-1
Enter Assert 2 information
Enter Product Type:
HDD
Enter Product ID:
222
Enter Product Description:
HardDisk
Enter Product Serial Number:
784565
Enter Product Parent ID:
111
Product Information

Assert 1 information

Product Type: Server
Product ID: 111
Product Description: Server
Product Serial Number: 123456
Product Parent ID: -1
Assert 2 information

Product Type: HDD
Product ID: 222
Product Description: HardDisk
Product Serial Number: 784565
Product Parent ID: 111

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote