Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

USE JAVA Each student, independent of each other, should populate their interface with some hard coded data (for example, name of computer image, application name,

USE JAVA

Each student, independent of each other, should populate their interface with some hard coded data (for example, name of computer image, application name, data size, and so on).

B. Panel for computer images. This panel would allow the user to examine an image: list applications in that image, view additional data needs for each application , view the total data requirements . Also consider how an application may be removed .

You have to make panels, You have to make interface design which contain information about computer Image. I am also providing code what i have add some data and make some changes as well.

Existing code :

Part A:

/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package hciproject; import java.util.*;

/** * * @author */ public class HCIproject {

/** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here Image image1, image2; image1 = new Image(); image2 = new Image(); AppObject a, b, c, d; a = new AppObject(); b = new AppObject(); c = new AppObject(); d = new AppObject(); a.setName("MS Office"); a.setDiskSize(2524); a.setCoresUsed(3); a.setRamSize(1399); b.setName("Firefox "); b.setDiskSize(122); b.setCoresUsed(1); b.setRamSize(1577); c.setName("Acrobat "); c.setDiskSize(682); c.setCoresUsed(2); c.setRamSize(889); d.setName("AutoCAD "); d.setDiskSize(51229); d.setCoresUsed(6); d.setRamSize(32000); image1.setName("Sales Laptops"); image1.addApplication(a, 200); image1.addApplication(b, 0); image1.addApplication(c, 100); image2.setName("Engineering Workstations"); image2.addApplication(a, 200); image2.addApplication(b, 0); image2.addApplication(c, 100); image2.addApplication(d, 500); printImage(image1); printImage(image2); image1.setApplicationData(a, 100); image1.setApplicationData(b, 50); image1.setApplicationData(c, 200); image2.setApplicationData(a, 300); image2.setApplicationData(b, 75); image2.setApplicationData(c, 500); image2.setApplicationData(d, 1000); System.out.println(""); System.out.println("==================="); System.out.println(""); System.out.println("-------------------"); printImage(image1); printImage(image2); image1.removeApplication(a); image1.removeApplication(c); image2.removeApplication(b); System.out.println(""); System.out.println("==================="); System.out.println(""); System.out.println("-------------------"); printImage(image1); printImage(image2); } public static void printImage(Image im){ System.out.println("Printing contents of \"" + im.getName() + "\" image:"); System.out.println("\tName \t\tRAM \tCores \tDisk Space \tExtra Disk Space"); for(int i = 0; i < im.getNumberOfApplications(); i++){ AppObject app; app = im.getApplication(i); System.out.print("\t" + app.getName() + "\t" + app.getDiskSize() + "\t" + app.getCoresUsed() + "\t" + app.getRamSize()); System.out.println("\t\t" + im.getApplicationExtraData(i)); } System.out.println("-------------------"); }

}

Part B:

Image.java

package HCIproject;

import java.util.ArrayList;

public class Image { private String name; // List for AppObject private ArrayList appObjectList = new ArrayList (); // List for AppObject data private ArrayList appDataList = new ArrayList (); /** * * @return */ public String getName() { return name; } /** * * @param name */ public void setName(String name) { this.name = name; } /** * * @param a * @param i */ public void addApplication(AppObject a, int i) { // Add to each list appObjectList.add(a); appDataList.add(new Integer(i)); } /** * * @param a * @param i */ public void setApplicationData(AppObject a, int i) { // Get the index of the object and add to the data list appDataList.set(appObjectList.indexOf(a), new Integer(i)); } /** * * @param a */ public void removeApplication(AppObject a) { // Remove from both the list appDataList.remove(appObjectList.indexOf(a)); appObjectList.remove(a); } /** * * @return */ public int getNumberOfApplications() { // Return the count of App object return appObjectList.size(); } /** * * @param i * @return */ public AppObject getApplication(int i) { // Get the application return appObjectList.get(i); } /** * * @param i * @return */ public int getApplicationExtraData(int i) { // Get application data return appDataList.get(i).intValue(); } } AppObject.java

package HCIproject;

public class AppObject { // Data members of the App objects private String name; private int diskSize; private int coresUsed; private int ramSize; // Getters and setters /** * * @return */ public String getName() { return name; } /** * * @param name */ public void setName(String name) { this.name = name; } /** * * @return */ public int getDiskSize() { return diskSize; } /** * * @param diskSize */ public void setDiskSize(int diskSize) { this.diskSize = diskSize; } /** * * @return */ public int getCoresUsed() { return coresUsed; } /** * * @param coresUsed */ public void setCoresUsed(int coresUsed) { this.coresUsed = coresUsed; } /** * * @return */ public int getRamSize() { return ramSize; } /** * * @param ramSize */ public void setRamSize(int ramSize) { this.ramSize = ramSize; }

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Visual Basic Net Database Programming

Authors: Rod Stephens

1st Edition

0789726815, 978-0789726810

More Books

Students also viewed these Databases questions

Question

Discuss the steps used in strategic planning.

Answered: 1 week ago

Question

Question Can a self-employed person adopt a money purchase plan?

Answered: 1 week ago