In Java please, Create a class called airConditioner which has 3 private attributes; integer temperature, boolean on and String location and has 5 behaviors: turning the air conditioner on and off (called turnON and turnOFF with no return and no arguments) checking to see if the air conditioner is on (called isON wihch returns boolean) sets the temperature( setTemp which receives an int argument) and gets current temp (getTemp) which accepts no value and returns the int temp
public class AirConditioner{
//private attirbutes
private int temperatue;
private boolean on;
private String location;
//behavior of the attributes
//turn on ac
public void turnON(){
this.on = true;
}
//turn off ac
public void turnOFF(){
this.on = false;
}
//check if ac is on
public boolean isON(){
return this.on;
}
//setting the temperature
public void setTemp(int temp){
this.temperatue = temp;
}
// getting the temperature
public int getTemp(){
return this.temperatue;
}
public static void main(String args[]){
AirConditioner ac = new
AirConditioner();
ac.turnON();
System.out.println(ac.isON());
ac.setTemp(23);
System.out.println(ac.getTemp());
ac.turnOFF();
System.out.println(ac.isON());
}
}
/*
sample output
true
23
false
*/
In Java please, Create a class called airConditioner which has 3 private attributes; integer temperature, boolean...
I need help writing a code for this. It has to be written in Python. Thank you. Suppose there is a class A Conditioner. The dass supports the following behaviors: turning the air condition on, off and setting the desired temperature. The following which accept no arguments and return no value, and set temp, which accepts an int argument and returns no value methods are provided for these behaviors: tur n on and turn off There is a reference yariable...
In Java: Requirements: 1. Create a class called Bike. 2. Create these private attributes: int currentSpeed int currentGear String paintColor 3. Create a constructor that takes 2 arguments: speed, gear, color. 4. Create another constructor that takes no arguments. 5. Create a method called goFaster(int amount) which increases the speed by the given amount. 6. Create a method called brake() which sets the speed to 0. 7. Create a method called print() which describes the bike and the speed it...
Create a java class for an object called Student which contains the following private attributes: a given name (String), a surname (family name) (String), a student ID number (an 8 digit number, String or int) which does not begin with 0. There should be a constructor that accepts two name parameters (given and family names) and an overloaded constructor accepting two name parameters and a student number. The constructor taking two parameters should assign a random number of 8 digits....
The Java class called Holiday is started below. An object of class Holiday represents a holiday during the year. This class has three instance variables: name, which is a String representing the name of the holiday day, which is an int representing the day of the month of the holiday month, which is a String representing the month the holiday is in public class Holiday { private String name; private int day; private String month; // your code goes here...
In java, create class BNode(T), which implements the interface TreeNode(T) interface methods: void setRight(TreeNode(T) right) - sets right side of node, where right is the node to the right of this node void setRight(TreeNode(T) left) - sets left side of node, where left is the node to the left of this node TreeNode getRight() - gets the right node TreeNode getLeft() - gets the left node T getData() - gets the data within the node THEN, create class BT(E), which...
Please help me with this code. Thank you Implement the following Java class: Vehicle Class should contain next instance variables: Integer numberOfWheels; Double engineCapacity; Boolean isElectric, String manufacturer; Array of integers productionYears; Supply your class with: Default constructor (which sets all variables to their respective default values) Constructor which accepts all the variables All the appropriate getters and setters (you may skip comments for this methods. Also, make sure that for engineCapacity setter method you check first if the vehicle...
java language please. thank you T-Mobile 9:00 AM For this assignment, create a Java class named "MyRectangle3d" Your class must have the following attributes or variables · x (the x coordinate of the rectangle, an integer) * y (the y coordinate of the rectangle, an integer) * length (the length of the rectangle, an integer) * width (the width of the rectangle, an integer) * height (the height of the rectangle, an integer) * color( the color of the rectangle,...
Write Java program( see IncomeTaxClassTemplate) uses a class( TaxTableToolTemplate), which has a tax table built in. The main method prompts for a salary, then uses a TaxTableTools method to get the tax rate. The program then calculates the tax to pay and displays the results to the user. Run the program with annual salaries of 10000, 50000, 50001, 100001 and -1 (to end the program) and note the output tax rate and tax to pay. a. Modify the TaxTableTools class...
JAVA Lab Create a class called ArrayBasedStack. Declare the following variables: • data: references an array storing elements in the list • topOfStack: an int value representing the location of the stack top in the array • INITIAL_CAPACITY: the default capacity of the stack public class ArrayBasedStack <E> { private E[] data; private int topOfStack; private static final int INITIAL_CAPACITY = 5; } Add a constructor that will initialize the stack with a user-defined initial capacity. The top of the...
FOR C++ PLEASE Create a class called "box" that has the following attributes (variables): length, width, height (in inches), weight (in pounds), address (1 line), city, state, zip code. These variables must be private. Create setter and getter functions for each of these variables. Also create two constructors for the box class, one default constructor that takes no parameters and sets everything to default values, and one which takes parameters for all of the above. Create a calcShippingPrice function that...