CODE :
public class HouseholdAppliance {
// Attributes
private String name;
private int voltage;
// Constructor
public HouseholdAppliance(String name, int voltage){
this.name = name;
this.voltage = voltage;
}
// Getters
public String getName(){
return this.name;
}
public int getVoltage(){
return this.voltage;
}
// Method to do an action
public void turnOn(){
System.out.println("The " + this.name + " is now turned on!");
}
// Method to display values
public void displayValues(){
System.out.println("Name: " + this.name + "\nVoltage: " + this.voltage);
}
// Main method
public static void main(String[] args){
HouseholdAppliance washingMachine = new HouseholdAppliance("Washing Machine", 220);
washingMachine.turnOn();
washingMachine.displayValues();
}
}
What is code ?
For the purposes of communication and information processing, a code is a set of principles that technology is getting as a letter, word, sound, picture, or gesture—into another form, often shorter or secret, for storage on a storage device or for transmission over a channel of communication. An early example is the development of language, which allowed people to express verbally what they were thinking, seeing, hearing, or feeling to others. However, speaking restricts the audience to those present at the time the speech is delivered and limits that range of communication towards the distance a voice may travel. The ability to communicate across space and time was greatly expanded by the discovery of printing, which converted spoken language into pictorial symbols.
To know more about code
https://brainly.com/question/1603398
#SPJ4