Questions Uploads
Detail the steps you would take to determine how to diagnose and reseat the RAM.
/in Questions Uploads /by Hannah Wanguihe rectangle’s perimeter and area
/in Questions Uploads /by Hannah WanguiQuestion
I am having a difficult time with what I’m doing incorrect here. Could someone guide me in the right direction.
class Rectangle with attributes length and width, each of which defaults to 1. Provide methods that calculate the rectangle’s perimeter and area. Use set and get methods for both length and width. The set methods will verify that length and width are each floating-point numbers larger than 0.0 and less than 20.0. A program to test class Rectangle.
public class Rectangle {
public float rectangle;
public float length;
public float width;
public float perimeter;
public float area;
public Rectangle(float length, float width){
if(length < 0.0 || length >= 20.0){
throw new IllegalArgumentException(“Length must be between 0.0 and 20.0”);
}
if(width < 0.0 || width >= 20.0){
throw new IllegalArgumentException(“Width must be between 0.0 abnd 20.00”);
}
this.length = length;
this.width = width;
}
public float getLength(){
return length;
}
public float getWidth(){
return width;
}
public void setPerimeter(float perimeter){
perimeter = ((getLength() *2) + (getWidth()*2));
}
public float getPerimeter(){
return perimeter;
}
public void setArea(float area){
area = getLength() * getWidth();
}
}
HERE IS MY TEST….
public class TestRectangle {
public static void main(String[] args){
Rectangle rectangle1 = new Rectangle( 3.2f,3.3f);
System.out.printf(“The perimeter of rectangle is: %d%n”,rectangle1.getPerimeter());
}
}
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"
Java code
/in Questions Uploads /by Hannah WanguiQuestion
I am currently struggling a bit with this Java code assignment. Would a tutor be able to assist me with a better
understanding to follow? thank you.
(Date Class): a class called Date that includes 3 instance variables—a month (type int), a day (type int), and a year (type int). Provide a constructor that initializes the 3 instance variables and assumes the values provided are correct. Provide a set and a get method for each instance variable. Provide a method displayDate that displays the month, day, and year separated by forward slashes(/). a test application named DateTest that demonstrates class Date’s capabilities.
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"
About Us
![]()
Since 2010, we have offered professional writing services to clients all over the world.
Over the years, our writers have gained solid experience in all academic disciplines, giving them a competitive edge to provide only first-rate academic papers.
![]()
QUICK LINKS
Contact Us
For any questions, feedback, or comments, we have an ethical customer support team that is always waiting on the line for your inquiries.
Talk to us
support@academicheroes.com
Call us: +1 (564) -222 6836