198k views
5 votes
Design and implement a set of classes that define various types of electronics equipment (computers, cell phones, pagers, digital cameras, etc.). Include data values that describe various attributes of the electronics, such as the weight, cost, power usage, and the names of the manufacturers. Include methods that are named appropriately for each class and that print an appropriate message. Create a main driver class to instantiate and exercise several of the classes github

1 Answer

3 votes

Answer:

class Electronics

{

String Name;

double weight;

double cost;

double power;

String brand_name;

public Electronics(String Nm, double wei,double rate, double pow,String brand)

{

Name=Nm;

weight=wei;

cost=rate;

power=pow;

brand_name=brand;

}

public void printDetails()

{

System.out.println("Item : "+Name);

System.out.println("Cost: $"+cost);

System.out.println("Power consumption :"+power+" watts per month");

System.out.println("weight: "+weight);

System.out.println("Manufacture :"+brand_name);

}

}

public class ElectonicsTest

{

public static void main(String[] args)

{

//instantiating objects of class electronics

Electronics item1=

new Electronics("Cell Phone",40.30,560.5,20,"Nokia");

item1. printDetails();

}

}

Step-by-step explanation:

User Mathk
by
3.9k points