Notes![what is notes.io? What is notes.io?](/theme/images/whatisnotesio.png)
![]() ![]() Notes - notes.io |
public class Call
{
private String number;
private CallZone zone;
private int minutes;
/**
* Create a call with the given number, call zone, and number of minutes.
*
* @param number the call's number.
* @param zone the call's call zone.
* @param minutes the call's duration in minutes.
* @pre. minutes is positive and number and zone are not null.
*/
public Call(String number, CallZone zone, int minutes)
{
assert(minutes > 0);
this.setNumber(number);
this.setZone(zone);
this.setMinutes(minutes);
}
/**
* Make a copy of the given call.
*
* @param call the call to make a copy of.
* @pre. call is not null.
*/
public Call(Call call)
{
this(call.getNumber(),call.getZone(),call.getMinutes());
}
/**
* Get the number of this call.
*
* @return the number of this call.
*/
public String getNumber()
{
return this.number;
}
/**
* Set the number of this call.
*
* @param number the number to set.
* @pre. number is not null.
*/
public void setNumber(String number)
{
this.number = number;
}
/**
* Get the zone of this call.
*
* @return the zone of this call.
*/
public CallZone getZone()
{
return this.zone;
}
/**
* Set the zone of this call.
*
* @param zone the zone to set.
* @pre. zone is not null.
*/
public void setZone(CallZone zone)
{
this.zone = zone;
}
/**
* Get the minutes of this call.
*
* @return the minutes of this call.
*/
public int getMinutes()
{
return this.minutes;
}
/**
* Set the number of minutes of this call.
*
* @param minutes the number of minutes to set
* @pre. minutes is positive.
*/
public void setMinutes(int minutes)
{
assert minutes > 0;
this.minutes = minutes;
}
/**
* Creates a string representation of the object.
* The string includes the number, call zone, and
* number of minutes of the call. For example,
* "call to number +14167362100 in zone CANDA for 12 minutes".
*
* @return the string representation of the object.
*/
@Override
public String toString()
{
return "call to number " + this.getNumber() + " in zone " + this.getZone() + " for " + this.getMinutes() + " minutes";
}
/**
* Creates a hash code for the object.
* The hash code is generated by considering the call's number, call zone, and number of minutes.
*
* @return the object's hash code.
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + minutes;
result = prime * result + ((number == null) ? 0 : number.hashCode());
result = prime * result + ((zone == null) ? 0 : zone.hashCode());
return result;
}
/**
* Indicates whether some other object is "equal to" this one.
* The result is true if and only if the argument is not null, is a call,
* and both objects have the same number, call zone, and number of minutes.
*
* @param obj the object to compare with.
* @return true if the calls' number, call zone, and number of minutes are equal; false otherwise.
*/
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Call other = (Call) obj;
if (minutes != other.minutes)
return false;
if (number == null) {
if (other.number != null)
return false;
} else if (!number.equals(other.number))
return false;
if (zone == null) {
if (other.zone != null)
return false;
} else if (!zone.equals(other.zone))
return false;
return true;
}
}
![]() |
Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 14 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team