Question: Design and implement a set of classes representing electronic equipment, including laptops,cellphones, and digital cameras. 1. Create an Equipment class that has attributes weight (double),
| Design and implement a set of classes representing electronic equipment, including laptops,cellphones, and digital cameras. 1. Create an Equipment class that has attributes weight (double), cost(double), power usage (wattage)(double), and manufacturer name (String). 2. Create classes for camera, laptop, cellphone. Cellphones also have a carrier name, Laptops have an amount of RAM, and cameras have a number of pixels. Duplicate as little code as possible. Derive Camera class, Cellphone class, and Laptop class from Equipment class Write constructors for the classes that set values for all the data. Write a writeOutput method in each class. Write all gets and sets (accessors and modifiers) Write whatever compareTo methods you need so that you can sort equipment according to cost. Write a main method that creates at least two laptops, two cellphones, and two cameras using the non-default constructor. Put all your objects into an ArrayList of Equipment objects and print out the arrayList. Use the Collections sort method to sort your arrayList. Finally, print pout your arrayList again - it should now be sorted. |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
