class Asset{
// Asset
private int assetID;
private String description;
private String purcDate;
private String orderNum;
private double costPrice;
private boolean status;
// Non argument Constructure
public Asset(){
}
// Argument Constructure
public Asset(int assetID, String description, String purcDate, String orderNum, double costPrice, boolean status){
this.assetID = assetID;
this.description = description;
this.purcDate = purcDate;
this.orderNum = orderNum;
this.costPrice = costPrice;
this.status = status;
}
// Copy Constructor
public Asset(Asset A){
this.assetID = A.assetID;
this.description = A.description;
this.purcDate = A.purcDate;
this.orderNum = A.orderNum;
this.costPrice = A.costPrice;
this.status = A.status;
}
// Setter Constructor
public void setAssetID(int newAssetID){
this.assetID = newAssetID;
}
public void setDescription(String newDescription){
this.description = newDescription;
}
public void setPurcDate(String newPurcDate){
this.purcDate = newPurcDate;
}
public void setOrderNum(String newOrderNum){
this.orderNum = newOrderNum;
}
public void setCostPrice(double newCostPrice){
this.costPrice = newCostPrice;
}
public void setStatus(boolean newStatus){
this.status = newStatus;
}
// Getter Constructor
public int getAssetID(){
return assetID;
}
public String getDescription(){
return description;
}
public String getPurcDate(){
return purcDate;
}
public String getOrderNum(){
return orderNum;
}
public double getCostPrice(){
return costPrice;
}
public boolean getStatus(){
return status;
}
// Equal Constructure
public boolean equals(int assetID){
if(this.assetID == assetID){
return true;
}else{
return false;
}
}
public String toString(){
return "\nAssetID :"+assetID+"\nDescription :"+description+"\nPurchase Date :"+purcDate+"\nOrder No. :"+orderNum+"\nCost Price :"+costPrice+"\nStatus :"+status;
}
}
class Appliance extends Asset{
// Appliance
private String appBrand;
private String appModel;
private int appSerial;
private String appWarranty;
private String appVendor;
// Non Argument Constructer
public Appliance(){
}
// Constructer with Argument
public Appliance(int assetID, String description, String purcDate, String orderNum, double costPrice, boolean status,
String appBrand, String appModel, int appSerial, String appWarranty, String appVendor){
super(assetID, description, purcDate, orderNum, costPrice, status);
this.appBrand = appBrand;
this.appModel = appModel;
this.appSerial = appSerial;
this.appWarranty = appWarranty;
this.appVendor = appVendor;
}
// Setter
public void setAppBrand(String newAppBrand){
this.appBrand = newAppBrand;
}
public void setAppModel(String newAppModel){
this.appModel = newAppModel;
}
public void setAppSerial(int newAppSerial){
this.appSerial = newAppSerial;
}
public void setAppWarranty(String newAppWarranty){
this.appWarranty = newAppWarranty;
}
public void setAppVendor(String newAppVendor){
this.appVendor = newAppVendor;
}
// Getter
public String getAppBrand(){
return appBrand;
}
public String getAppModel(){
return appModel;
}
public int getAppSerial(){
return appSerial;
}
public String getAppWarranty(){
return appWarranty;
}
public String getAppVendor(){
return appVendor;
}
// Equal Constructure
public boolean equals(int appSerial){
if(this.appSerial == appSerial){
return true;
}else{
return false;
}
}
public String toString(){
return super.toString()+"\nBrand :"+appBrand+"\nModel :"+appModel+"\nSerial :"+appSerial+"\nWarranty :"+appWarranty+"\nVendor :"+appVendor;
}
}
class Ict extends Asset{
// ICT
private String ictBrand;
private String ictModel;
private int ictSerialNo;
private String ictWarranty;
private String ictVendor;
private String ictMaintenanceDate;
// Non Argument Constructer
public Ict(){
}
// Constructer With Argument
public Ict(int assetID, String description, String purcDate, String orderNum, double costPrice, boolean status,
String ictBrand, String ictModel, int ictSerialNo, String ictWarranty, String ictVendor, String ictMaintenanceDate){
super(assetID, description, purcDate, orderNum, costPrice, status);
this.ictBrand = ictBrand;
this.ictModel = ictModel;
this.ictSerialNo = ictSerialNo;
this.ictWarranty = ictWarranty;
this.ictVendor = ictVendor;
this.ictMaintenanceDate = ictMaintenanceDate;
}
// Setter
public void setIctBrand(String newIctBrand){
this.ictBrand = newIctBrand;
}
public void setIctModel(String newIctModel){
this.ictModel = newIctModel;
}
public void setIctSerialNo(int newIctSerialNo){
this.ictSerialNo = newIctSerialNo;
}
public void setIctWarranty(String newIctWarranty){
this.ictWarranty = newIctWarranty;
}
public void setIctVendor(String newIctVendor){
this.ictVendor = newIctVendor;
}
public void setIctMaintenanceDate(String newIctMaintenanceDate){
this.ictMaintenanceDate = newIctMaintenanceDate;
}
// Getter
public String getIctBrand(){
return ictBrand;
}
public String getIctModel(){
return ictModel;
}
public int getIctSerialNo(){
return ictSerialNo;
}
public String getIctWarranty(){
return ictWarranty;
}
public String getIctVendor(){
return ictVendor;
}
public String getIctMaintenanceDate(){
return ictMaintenanceDate;
}
// Equal Constructure
public boolean equals(int ictSerialNo){
if(this.ictSerialNo == ictSerialNo){
return true;
}else{
return false;
}
}
public String toString(){
return super.toString()+"\nBrand :"+ictBrand+"\nModel :"+ictModel+"\nSerial No. :"+ictSerialNo+"\nWarranty :"+ictWarranty+"\nVendor :"+ictVendor+"\nMaintenance :"+ictMaintenanceDate;
}
}
class Vehicle extends Asset{
// Vehichle
private String vehMake;
private String vehModel;
private int vehEngineNo;
private int vehChassisNo;
private int vehRegistrationNo;
private String vehWarranty;
private String vehVendor;
private String vehMaintenanceDate;
// Non Argument Constructer
public Vehicle(){
}
// Constructer with Argument
public Vehicle(int assetID, String description, String purcDate, String orderNum, double costPrice, boolean status,
String vehMake, String vehModel, int vehEngineNo, int vehChassisNo, int vehRegistrationNo, String vehWarranty, String vehVendor, String vehMaintenanceDate){
super(assetID, description, purcDate, orderNum, costPrice, status);
this.vehMake = vehMake;
this.vehModel = vehModel;
this.vehEngineNo = vehEngineNo;
this.vehChassisNo = vehChassisNo;
this.vehRegistrationNo = vehRegistrationNo;
this.vehWarranty = vehWarranty;
this.vehVendor = vehVendor;
this.vehMaintenanceDate = vehMaintenanceDate;
}
// Setter
public void setVehMake(String newVehMake){
this.vehMake = newVehMake;
}
public void setVehModel(String newVehModel){
this.vehModel = newVehModel;
}
public void setVehEngineNo(int newVehEngineNo){
this.vehEngineNo = newVehEngineNo;
}
public void setVehChasisNo(int newVehChasisNo){
this.vehChassisNo = newVehChasisNo;
}
public void setVehRegistrationNo(int newVehRegistrationNo){
this.vehRegistrationNo = newVehRegistrationNo;
}
public void setVehWarranty(String newVehWarranty){
this.vehWarranty = newVehWarranty;
}
public void setVehVendor(String newVehVendor){
this.vehVendor = newVehVendor;
}
public void setVehMaintenanceDate(String newVehMaintanenceDate){
this.vehMaintenanceDate = newVehMaintanenceDate;
}
// Getter
public String getVehMake(){
return vehMake;
}
public String getVehModel(){
return vehModel;
}
public int getVehEngineNo(){
return vehEngineNo;
}
public int getVehChasisNo(){
return vehChassisNo;
}
public int getVehRegistrationNo(){
return vehRegistrationNo;
}
public String getVehWarranty(){
return vehWarranty;
}
public String getVehVendor(){
return vehVendor;
}
public String getVehMaintenanceDate(){
return vehMaintenanceDate;
}
// Equal Constructure
public boolean vehEngineNo(int vehEngineNo){
if(this.vehEngineNo == vehEngineNo){
return true;
}else{
return false;
}
}
public String toString(){
return super.toString()+"\nMake :"+vehMake+"\nModel :"+vehModel+"\nEngine No. :"+vehEngineNo+"\nChasis No. :"+vehChassisNo+"\nRegistration No. :"
+vehRegistrationNo+"\nWarranty :"+vehWarranty+"\nVendor :"+vehVendor+"\nMaintenance :"+vehMaintenanceDate;
}
}
And this will be my half way done program
import javax.swing.*; // Import to use JOptionPane
import java.lang.*; // Import to use String method
import java.util.*; // Import to use try catch 'Exception Types'
public class AppPro{
public static void main(String [] args){
java.util.Date date = new java.util.Date(); // Use To Display Current Time
final int MAXINDEX = 100; // Maximum Asset = 100
Asset[] list = new Asset[MAXINDEX]; // Array of Asset
int choice = -1; // Choice at -1, due to 0 is use to exit menu
int types = -1;
int index = 0; // Starting index at 0
JOptionPane.showMessageDialog(null, "SunShine Sdn Bhd System", "Welcome!", JOptionPane.INFORMATION_MESSAGE);
do{
try{
// Selection Main Menu
choice = Integer.parseInt(JOptionPane.showInputDialog(null, "Please Make A Selection.\n" + "1. Add a new Asset.\n" +
"2. Amend details of Asset.\n" + "3. Search for an Asset.\n" +
"4. Write Off Status.\n" + "5. List Out Asset.\n" +
"0. Exit.\n" + "Enter your choice:", "SunShine Sdn Bhd Main Menu", JOptionPane.INFORMATION_MESSAGE));
switch(choice){
// Create New Asset Function
case 1:{
if(index<MAXINDEX){
types = Integer.parseInt(JOptionPane.showInputDialog(null, "Make A Selection\n" + "1.Appliance\n" + "2.ICT\n" + "3.Vehicle\n" + "0.Main Menu\n" + "Enter your choice:"
,"Selection Menu", JOptionPane.INFORMATION_MESSAGE));
switch(types){
case 1:{
int assetID = Integer.parseInt(JOptionPane.showInputDialog(null, "Enter Asset ID:", "Asset ID Menu", JOptionPane.QUESTION_MESSAGE));
String description = JOptionPane.showInputDialog(null, "Enter Short Description:", "Description Menu", JOptionPane.QUESTION_MESSAGE);
String purcDate = JOptionPane.showInputDialog(null, date.toString() + "\nEnter Date(DD/MM/YY):", "Purchase Date Menu", JOptionPane.QUESTION_MESSAGE);
String orderNum = JOptionPane.showInputDialog(null, "Enter Order No.:", "Order No. Menu", JOptionPane.QUESTION_MESSAGE);
double costPrice = Double.parseDouble(JOptionPane.showInputDialog(null, "Cost Price:", "Cost Price Menu", JOptionPane.QUESTION_MESSAGE));
String appBrand = JOptionPane.showInputDialog(null, "Brand:");
String appModel = JOptionPane.showInputDialog(null, "Model:");
int appSerial = Integer.parseInt(JOptionPane.showInputDialog(null, "Serial:"));
String appWarranty = JOptionPane.showInputDialog(null, "Warranty:");
String appVendor = JOptionPane.showInputDialog(null, "Vendor:");
boolean isDuplicate = false;
for(int i=0; i<index; i++){
if(list[i].equals(assetID) && list[i].equals(appSerial)){
isDuplicate = true;
}
}
if(isDuplicate){
JOptionPane.showMessageDialog(null, "Asset Existed", "Warning!", JOptionPane.WARNING_MESSAGE);
}else{
list[index] = new Appliance(assetID, description, purcDate, orderNum, costPrice, true, appBrand, appModel, appSerial, appWarranty, appVendor);
index++;
}
break;
}
case 2:{
int assetID = Integer.parseInt(JOptionPane.showInputDialog(null, "Enter Asset ID:", "Asset ID Menu", JOptionPane.QUESTION_MESSAGE));
String description = JOptionPane.showInputDialog(null, "Enter Short Description:", "Description Menu", JOptionPane.QUESTION_MESSAGE);
String purcDate = JOptionPane.showInputDialog(null, date.toString() + "\nEnter Date(DD/MM/YY):", "Purchase Date Menu", JOptionPane.QUESTION_MESSAGE);
String orderNum = JOptionPane.showInputDialog(null, "Enter Order No.:", "Order No. Menu", JOptionPane.QUESTION_MESSAGE);
double costPrice = Double.parseDouble(JOptionPane.showInputDialog(null, "Cost Price:", "Cost Price Menu", JOptionPane.QUESTION_MESSAGE));
String ictBrand = JOptionPane.showInputDialog(null, "Brand:");
String ictModel = JOptionPane.showInputDialog(null, "Model:");
int ictSerialNo = Integer.parseInt(JOptionPane.showInputDialog(null, "Serial:"));
String ictWarranty = JOptionPane.showInputDialog(null, "Warranty:");
String ictVendor = JOptionPane.showInputDialog(null, "Vendor:");
String ictMaintenanceDate = JOptionPane.showInputDialog(null, "Date:");
boolean isDuplicate = false;
for(int i=0; i<index; i++){
if(list[i].equals(assetID) && list[i].equals(ictSerialNo)){
isDuplicate = true;
}
}
if(isDuplicate){
JOptionPane.showMessageDialog(null, "Asset Existed", "Warning!", JOptionPane.WARNING_MESSAGE);
}else{
list[index] = new Ict(assetID, description, purcDate, orderNum, costPrice, true, ictBrand, ictModel, ictSerialNo, ictWarranty, ictVendor,
ictMaintenanceDate);
index++;
}
break;
}
case 3:{
int assetID = Integer.parseInt(JOptionPane.showInputDialog(null, "Enter Asset ID:", "Asset ID Menu", JOptionPane.QUESTION_MESSAGE));
String description = JOptionPane.showInputDialog(null, "Enter Short Description:", "Description Menu", JOptionPane.QUESTION_MESSAGE);
String purcDate = JOptionPane.showInputDialog(null, date.toString() + "\nEnter Date(DD/MM/YY):", "Purchase Date Menu", JOptionPane.QUESTION_MESSAGE);
String orderNum = JOptionPane.showInputDialog(null, "Enter Order No.:", "Order No. Menu", JOptionPane.QUESTION_MESSAGE);
double costPrice = Double.parseDouble(JOptionPane.showInputDialog(null, "Cost Price:", "Cost Price Menu", JOptionPane.QUESTION_MESSAGE));
String vehMake = JOptionPane.showInputDialog(null, "Make:");
String vehModel = JOptionPane.showInputDialog(null, "Model:");
int vehEngineNo = Integer.parseInt(JOptionPane.showInputDialog(null, "Engine:"));
int vehChassisNo = Integer.parseInt(JOptionPane.showInputDialog(null, "Chassis:"));
int vehRegistrationNo = Integer.parseInt(JOptionPane.showInputDialog(null, "Reg:"));
String vehWarranty = JOptionPane.showInputDialog(null, "Warranty:");
String vehVendor = JOptionPane.showInputDialog(null, "Vendor:");
String vehMaintenanceDate = JOptionPane.showInputDialog(null, "Date:");
boolean isDuplicate = false;
for(int i=0; i<index; i++){
if(list[i].equals(assetID) && list[i].equals(vehEngineNo)){
isDuplicate = true;
}
}
if(isDuplicate){
JOptionPane.showMessageDialog(null, "Asset Existed", "Warning!", JOptionPane.WARNING_MESSAGE);
}else{
list[index] = new Vehicle(assetID, description, purcDate, orderNum, costPrice, true, vehMake, vehModel, vehEngineNo, vehChassisNo, vehRegistrationNo,
vehWarranty, vehVendor, vehMaintenanceDate);
index++;
}
break;
}
case 0:{
break;
}
}
}else{
JOptionPane.showMessageDialog(null, "Sorry, Full!", "Warning!", JOptionPane.WARNING_MESSAGE); // Error Message
}
break;
}
// Amend Asset Function
case 2:{
String num = "";
int selection = Integer.parseInt(JOptionPane.showInputDialog(null, "Which Category To change?\n"+"1.Appliance\n"+"2.Vehicle\n"+"3.ICT",
"Amend Function Menu", JOptionPane.QUESTION_MESSAGE));
switch(selection){
case 1:{
for(int i = 0; i < index; i++){
num = num + (i + 1) + " - " + list[i].getAssetID() + "\n";
}
int appAmend = Integer.parseInt(JOptionPane.showInputDialog(null, "Which Asset To Change?\n" + num +
"\nEnter choice, following the Index No.", "Amend Function Menu", JOptionPane.QUESTION_MESSAGE));
if( (appAmend-1) < index){
String description = JOptionPane.showInputDialog(null, "Enter Short Description:", "Description Menu", JOptionPane.QUESTION_MESSAGE);
String purcDate = JOptionPane.showInputDialog(null, date.toString() + "\nEnter Date(DD/MM/YY):", "Purchase Date Menu", JOptionPane.QUESTION_MESSAGE);
String orderNum = JOptionPane.showInputDialog(null, "Enter Order No.:", "Order No. Menu", JOptionPane.QUESTION_MESSAGE);
double costPrice = Double.parseDouble(JOptionPane.showInputDialog(null, "Enter Cost Price:", "Cost Price Menu", JOptionPane.QUESTION_MESSAGE));
String appBrand = JOptionPane.showInputDialog(null, "Brand:");
String appModel = JOptionPane.showInputDialog(null, "Model:");
int appSerial = Integer.parseInt(JOptionPane.showInputDialog(null, "Serial:"));
String appWarranty = JOptionPane.showInputDialog(null, "Warranty:");
String appVendor = JOptionPane.showInputDialog(null, "Vendor:");
list[appAmend-1].setDescription(description);
list[appAmend-1].setPurcDate(purcDate);
list[appAmend-1].setOrderNum(orderNum);
list[appAmend-1].setCostPrice(costPrice);
list[appAmend-1].setAppBrand(appBrand);
list[appAmend-1].setAppModel(appModel);
list[appAmend-1].setAppSerial(appSerial);
list[appAmend-1].setAppWarranty(appWarranty);
list[appAmend-1].setAppVendor(appVendor);
}else{
JOptionPane.showMessageDialog(null, "Please Enter Available Index No.", "Error Message!", JOptionPane.WARNING_MESSAGE);
}
break;
}
case 2:{
for(int i = 0; i < index; i++){
num = num + (i + 1) + " - " + list[i].getAssetID() + "\n";
}
int ictAmend = Integer.parseInt(JOptionPane.showInputDialog(null, "Which Asset To Change?\n" + num +
"\nEnter choice, following the Index No.", "Amend Function Menu", JOptionPane.QUESTION_MESSAGE));
if( (ictAmend-1) < index){
String description = JOptionPane.showInputDialog(null, "Enter Short Description:", "Description Menu", JOptionPane.QUESTION_MESSAGE);
String purcDate = JOptionPane.showInputDialog(null, date.toString() + "\nEnter Date(DD/MM/YY):", "Purchase Date Menu", JOptionPane.QUESTION_MESSAGE);
String orderNum = JOptionPane.showInputDialog(null, "Enter Order No.:", "Order No. Menu", JOptionPane.QUESTION_MESSAGE);
double costPrice = Double.parseDouble(JOptionPane.showInputDialog(null, "Enter Cost Price:", "Cost Price Menu", JOptionPane.QUESTION_MESSAGE));
String ictBrand = JOptionPane.showInputDialog(null, "Brand:");
String ictModel = JOptionPane.showInputDialog(null, "Model:");
int ictSerialNo = Integer.parseInt(JOptionPane.showInputDialog(null, "Serial:"));
String ictWarranty = JOptionPane.showInputDialog(null, "Warranty:");
String ictVendor = JOptionPane.showInputDialog(null, "Vendor:");
String ictMaintenanceDate = JOptionPane.showInputDialog(null, "Date:");
list[ictAmend-1].setDescription(description);
list[ictAmend-1].setPurcDate(purcDate);
list[ictAmend-1].setOrderNum(orderNum);
list[ictAmend-1].setCostPrice(costPrice);
list[ictAmend-1].setIctBrand(ictBrand);
list[ictAmend-1].setIctModel(ictModel);
list[ictAmend-1].setIctSerialNo(ictSerialNo);
list[ictAmend-1].setIctWarranty(ictWarranty);
list[ictAmend-1].setIctVendor(ictVendor);
list[ictAmend-1].setIctMaintenanceDate(ictMaintenanceDate);
}else{
JOptionPane.showMessageDialog(null, "Please Enter Available Index No.", "Error Message!", JOptionPane.WARNING_MESSAGE);
}
break;
}
case 3:{
for(int i = 0; i < index; i++){
num = num + (i + 1) + " - " + list[i].getAssetID() + "\n";
}
int vehAmend = Integer.parseInt(JOptionPane.showInputDialog(null, "Which Asset To Change?\n" + num +
"\nEnter choice, following the Index No.", "Amend Function Menu", JOptionPane.QUESTION_MESSAGE));
if( (vehAmend-1) < index){
String description = JOptionPane.showInputDialog(null, "Enter Short Description:", "Description Menu", JOptionPane.QUESTION_MESSAGE);
String purcDate = JOptionPane.showInputDialog(null, date.toString() + "\nEnter Date(DD/MM/YY):", "Purchase Date Menu", JOptionPane.QUESTION_MESSAGE);
String orderNum = JOptionPane.showInputDialog(null, "Enter Order No.:", "Order No. Menu", JOptionPane.QUESTION_MESSAGE);
double costPrice = Double.parseDouble(JOptionPane.showInputDialog(null, "Enter Cost Price:", "Cost Price Menu", JOptionPane.QUESTION_MESSAGE));
String vehMake = JOptionPane.showInputDialog(null, "Make:");
String vehModel = JOptionPane.showInputDialog(null, "Model:");
int vehEngineNo = Integer.parseInt(JOptionPane.showInputDialog(null, "Engine:"));
int vehChassisNo = Integer.parseInt(JOptionPane.showInputDialog(null, "Chassis:"));
int vehRegistrationNo = Integer.parseInt(JOptionPane.showInputDialog(null, "Reg:"));
String vehWarranty = JOptionPane.showInputDialog(null, "Warranty:");
String vehVendor = JOptionPane.showInputDialog(null, "Vendor:");
String vehMaintenanceDate = JOptionPane.showInputDialog(null, "Date:");
list[vehAmend-1].setDescription(description);
list[vehAmend-1].setPurcDate(purcDate);
list[vehAmend-1].setOrderNum(orderNum);
list[vehAmend-1].setCostPrice(costPrice);
list[vehAmend-1].setVehMake(vehMake);
list[vehAmend-1].setVehModel(vehModel);
list[vehAmend-1].setVehEngineNo(vehEngineNo);
list[vehAmend-1].setVehChassisNo(vehChassisNo);
list[vehAmend-1].setVehRegistrationNo(vehRegistrationNo);
list[vehAmend-1].setVehWarranty(vehWarranty);
list[vehAmend-1].setVehVendor(vehVendor);
list[vehAmend-1].setVehMaintenanceDate(vehMaintenanceDate);
}else{
JOptionPane.showMessageDialog(null, "Please Enter Available Index No.", "Error Message!", JOptionPane.WARNING_MESSAGE);
}
break;
}
case 0:{
break;
}
break;
}
}
// Search Asset Function
case 3:{
int key = Integer.parseInt(JOptionPane.showInputDialog(null, "Enter An Asset ID", "Search Function Menu", JOptionPane.QUESTION_MESSAGE));
// Check for same asset
boolean isEquals = false;
for(int i = 0; i<index; i++){
if(key == list[i].getAssetID()){
isEquals = true;
}
}
// Display message if same asset found or not
if(isEquals){
JOptionPane.showMessageDialog(null, "Asset Available", "Confirm Message", JOptionPane.INFORMATION_MESSAGE);
}else{
JOptionPane.showMessageDialog(null, "Asset Not Available", "Error Message!", JOptionPane.ERROR_MESSAGE);
}
break;
}
// Write off Asset Function
case 4:{
int key = Integer.parseInt(JOptionPane.showInputDialog(null, "Enter An Asset ID", "Asset Status Checking Menu", JOptionPane.QUESTION_MESSAGE));
// Check for same Asset and to write off or not
boolean isExist = false;
for(int i=0; i<index; i++){
if(key == list[i].getAssetID()){
isExist = true; // Same asset found
int mod = JOptionPane.showConfirmDialog(null, "Asset Status\nAsset ID:" + list[i].getAssetID() + "\nCondition:" + list[i].getStatus() +
"\nWrite Off Status?", "Asset Status Menu", JOptionPane.YES_NO_OPTION);
if(mod == JOptionPane.YES_OPTION){
list[i].setStatus(false); // Write off the Asset status
break;
}else if(mod == JOptionPane.NO_OPTION){
break;
}else{
JOptionPane.showMessageDialog(null, "Invalid Input", "Error Message!", JOptionPane.WARNING_MESSAGE);
}
}
}
if(isExist == false){
JOptionPane.showMessageDialog(null, "Asset Not Exist", "Error Message", JOptionPane.WARNING_MESSAGE);
}
break;
}
// Display Asset Function
case 5:{
int assetList = 0;
// Error Message if no Asset in array
if(index == 0){
JOptionPane.showMessageDialog(null, "No Asset!", "Error Message!", JOptionPane.WARNING_MESSAGE);
}else{
while(assetList < index){
String message = "No Asset ID\tDescription\tPurchase Date\tOrder No.\tCost Price\tStatus\n";
for(int i = 1; i < 20; i++){
if((assetList+i) <= index){
message = message + (assetList+i) +" "+ list[(assetList+i-1)].getAssetID() +"\t"+
list[(assetList+i-1)].getDescription() +"\t"+ list[(assetList+i-1)].getPurcDate() +
"\t"+ list[(assetList+i-1)].getOrderNum() +"\t"+ list[(assetList+i-1)].getCostPrice() +"\t"+
list[(assetList+i-1)].getStatus() + "\n" ;
}
}
JScrollPane jsp = new JScrollPane(new JTextArea(message));
jsp.setPreferredSize(new java.awt.Dimension(500,100)); // define the frame size (width,height)
JOptionPane.showMessageDialog(null, jsp, "Display Function Menu", JOptionPane.INFORMATION_MESSAGE, null);
// Display maximum 20 asset per page
assetList += 20;
}
}
break;
}
case 0:{
JOptionPane.showMessageDialog(null, "Thanks You & Bye", "Exit Message", JOptionPane.INFORMATION_MESSAGE); // Exiting
break;
}
default:
JOptionPane.showMessageDialog(null, "Please Key in 1 - 5 or 0 to exit", "Error Message!", JOptionPane.WARNING_MESSAGE); // Invalid digit input
break;
}
}catch(IllegalArgumentException ex){
JOptionPane.showMessageDialog(null, "Invalid Input!", "Error Message!", JOptionPane.WARNING_MESSAGE); // Invalid input
}
}while(choice != 0); // End program with input 0 in main menu
}
}
This part doesn't work. I wonder why??
From my main program, I get an error code of
"Cannot find symbol method setAppBrand(java.lang.String)" and so on for other at this part:
list[appAmend-1].setAppBrand(appBrand); list[appAmend-1].setAppModel(appModel); list[appAmend-1].setAppSerial(appSerial); list[appAmend-1].setAppWarranty(appWarranty); list[appAmend-1].setAppVendor(appVendor);
following by others (ICT and Vehicle).
This post has been edited by dragon528: 03 August 2010 - 08:46 AM

New Topic/Question
Reply




MultiQuote




|