The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Jul 2017 |
| Last Sign in: | 364 Weeks Ago, 2 Days Ago |
| Questions Answered: | 1850 |
| Tutorials Posted: | 1850 |
Graduate in Biology and Nutrition, MBA Finance
Florida State University
Aug-2000 - Jul-2007
Ass. Relationship Manager
Penn-Florida
Mar-2009 - Feb-2016
Hello, do you think you can help me with this assignment?
/*
 * Small class to practice writing JUnit testsÂ
 * Author: Renata Rand McFadden
 * version 1
 */
public class MyFax {
Â
// attributes
private String type; Â Â Â // fax typeÂ
private String serial; Â Â // fax serial number
private long number; Â // phone number to dial - 10 digits (note that does not allow leading 0s)
Â
// default constructor
// Assigns "None" to type and serial and -1 to number
public MyFax()
{
type = serial = "None";
number = -1;
}
Â
// constructor
// throws IllegalArgumentException if either parameter is null or an empty string
// otherwise assigns parameter value of t to type and s to serial
public MyFax(String t, String s)
{
if (s == null || s == "")
{
throw new NullPointerException("Parameter cannot be null or empty");
}
type = t; Â // assign t value of parameter to attribute type
serial = s; // assign s value of parameter to attribute serial
}
Â
// returns current value of number attribute
public long getNumber()
{
return number;
}
Â
// returns current value of type attribute
public String getType()
{
return type;
}
Â
// returns current value of serial attribute
public String getSerial()
{
return serial;
}
Â
// throws IllegalArgumentException if number is not a positive value or not 10 digits
// otherwise assigns parameter value of num to number attribute
// Implementation does not allow leading 0s
public void setNumber(long num)
{
int length = String.valueOf(num).length();
if (num < 1 || length < 10 )
{
throw new IllegalArgumentException("Parameter must be positive value and 10 digits");
}
number = num; Â // assign num value of parameter to attribute number
}
Â
}
Â
Â
Attachments:Hel-----------lo -----------Sir-----------/Ma-----------dam----------- Â----------- -----------Tha-----------nk -----------you----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------acq-----------uis-----------iti-----------on -----------of -----------my -----------pos-----------ted----------- so-----------lut-----------ion-----------.Pl-----------eas-----------e p-----------ing----------- me----------- on----------- ch-----------at -----------I a-----------m Â----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I