HELLO, i really need help with this java project i can fail the course if its no
ID: 3536057 • Letter: H
Question
HELLO, i really need help with this java project i can fail the course if its not finished
can someone plz help me with this ..
Project Details:
DEVICE STORE HIERARCHY Overview and Background:
It is conceivable that an Object Hierarchy could be designed to contain locations for the description of all the devices manufactured for use in today's technological society. The flexibility of an Object Oriented programming language would lend itself quite nicely to such a project, since you would be constantly modifying the structure to take into account new categories of devices as you discovered them.
For this project, you will only need to concern yourself with a very small piece of such a Hierarchy, the portion used to store computers:
The grey-background boxes are the classes that you must create, you can see how the hierarchy goes from more abstract at the top to concrete at the bottom. In this example, a database of computers will consist of objects created from the Desktop, Notebook and Supercomputer classes.
A Desktop class will be described by the following fields:
ï‚· Manufacturer
ï‚· Model
ï‚· Processor Type
ï‚· Line Voltage (AC Volts)
ï‚· Current Used (Amps)
ï‚· Hard Disk Size (GB)
ï‚· Available PCI Slots
A Notebook class will be described by the following fields:
ï‚· Manufacturer
ï‚· Model
ï‚· Processor Type
ï‚· Line Voltage (AC Volts)
ï‚· Current Used (Amps)
ï‚· Hard Disk Size (GB)
ï‚· Weight (kg)
ï‚· Screen Size (diagonal, inches)
A Supercomputer class will be described by the following fields:
ï‚· Manufacturer
ï‚· Model
ï‚· Processor Type
ï‚· Line Voltage (AC Volts)
ï‚· Current Used (Amps)
ï‚· Number of Processors
Of course, these descriptions are not complete, but again, you can treat this as a trial of the hierarchy. It would not be difficult to add more fields later.
PROJECT DETAILS:
You must decide which classes will declare which fields, all as private attributes. No field should be declared in more than one class. Each class must also contain a private, static attribute to count the number of objects created of that type, and an accessor to return that number. Each class must contain a constructor, and a toString() method.
The Device class will also need a compareTo method. Base the comparisons on the string formed from manufacturer concatenated with model. You will also need a couple of accessor methods in the Device class, to provide manufacturer and model. No other methods are required. This is enough work!
Don't worry about error checking in the constructors, throwing exceptions, or any of the other standard ADT methods. Do not write any mutators. Think of the structure you are building as just a framework to prove the concept.
That's eight classes you have to write. I expect you will be using the "extends" and "super" keywords quite often. The ninth class, TestDB, will be used to test the structure you have created. Most of the code for this class is supplied, and you cannot change it, except to write a sorting method (selection sort is suggested) to sort the array in TestDB.
Your sample output must be a close match to the sample output supplied with TestDB. TestDB can be considered to be "stub" code for the sole purpose of testing your hierarchy - it is not intended to represent a real database!
You must use this class to test your hierarchy: TestDB.java. You must complete the sorting method in this class, but cannot change any other code.
TestDB.java :
Explanation / Answer
class Device{
private static int noOfObjects;
private String manufacturer;
private String model;
private double lineVoltage;
private double currentUsed;
void Device(String manuf,String model,double lV,double cU){
this.noOfobjects += 1;
this.manufacturer = manuf;
this.model=model;
this.lineVoltage=lV;
this.currentUsed=cU;
}
String getManufacturer(){
return this.manufacturer;
}
String getModel(){
return this.model;
}
int get_noOfObjects(){
return this.noOfObjects;
}
}
class Computer extends Device{
void Computer(String manuf,String model,double lV,double cU){
super(String manuf,String model,double lV,double cU);
}
}
class PersonalComputer extends Computer{
private int hardDiskSize;
void PersonalComputer(String manuf,String model,double lV,double cU,int hDS){
this.hardDiskSize=hDS;
super(String manuf,String model,double lV,double cU);
}
}
class Notebook extends PersonalComputer{
private double weight;
private double screenSize;
void Notebook(String manuf,String model,double lV,double cU,double wt,double sZ){
this.weight=wt;
this.screenSize=sZ;
super(String manuf,String model,double lV,double cU);
}
}
class Desktop extends PersonalComputer{
private int PCISlots;
void Desktop(String manuf,String model,double lV,double cU,int pci){
this.PCISlots = pci;
super(String manuf,String model,double lV,double cU);
}
}
class MultiUser extends Computer
void MultiUser(String manuf,String model,double lV,double cU){
super(String manuf,String model,double lV,double cU);
}
}
class SuperComputer extends MultiUser{
private noOfProcessors;
void SuperComputer(String manuf,String model,double lV,double cU,int p){
this.noOfProcessors=p;
super(String manuf,String model,double lV,double cU);
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.