* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
1 2 3 4 5 6 7 8 1 * * * * * * * * 2 * * * * * * * * 3 * * * * * * * * 4 * * * * * * * * 5 * * * * * * * *
import java.util.*;
class Rectangle
{
public static void main(String [] args)
{
int length,width;
Scanner input=new
Scanner(System.in);
System.out.print("Enter Length of
Rectangle:\t");
length=input.nextInt();
System.out.print("Enter Width of
Rectangle:\t");
width=input.nextInt();
printFigure(length,width);
}
static void printFigure(int l,int w)
{
System.out.println("Without
Heading\n");
for (int i=0;i<l;i++)
{
for (int
j=0;j<w;j++)
{
System.out.print("*\t");
}
System.out.println("");
}
System.out.println("\n\nWith
Heading\n\n");
for (int i=1;i<=w;i++)
System.out.print("\t"+i);
System.out.println("");
for (int i=0;i<l;i++)
{
System.out.print(i+1);
for (int
j=0;j<w;j++)
{
System.out.print("\t*");
}
System.out.println("");
}
}
}
Create the class Rectangle. The class will have two int properties, length and width. Create the...
In JAVA 1. Create a class called Rectangle that has integer data members named - length and width. Your class should have a default constructor (no arg constructor) Rectangle() that initializes the two instance variables of the object Rect1. The second overloading constructor should initializes the value of the second object Rect2. The class should have a member function named GetWidth() and GetLength() that display rectangle's length and width. OUTPUT: Rectl width: 5 Rectl length: 10 Enter a width :...
For this question you must write a java class called Rectangle and a client class called RectangleClient. The partial Rectangle class is given below. (For this assignment, you will have to submit 2 .java files: one for the Rectangle class and the other one for the RectangleClient class and 2 .class files associated with these .java files. So in total you will be submitting 4 files for part b of this assignment.) // A Rectangle stores an (x, y) coordinate...
Create three variables for an int array, the size of the array, and a Scanner object to read keyboard input. Ask the user to specify the size of the array and then construct an int array of that size. Next, use a for loop to continuously ask the user to specify values for each location in the array. Lastly, print contents of the array as a histogram using the asterisk character (*). This will require using nested for loops. The...
Java Instructions of assignment: Inside 1st class - Find the int width and height of a rectangle; include methods to set and get the width and height; and a method to calculate and return the area Inside 2nd class - Use an ArrayList to store 10 unique dimensions of the rectangle class - Set the width & height using a constructor or setter methods - Create a bubble sort algorithm list inside a method to set the areas in descending...
Make a LandTract class with the following fields: LandTract is a rectangle. * length - an int containing the tract's length * width - an int containing the tract's width The class should have a constructor with two arguments length and width and assign these to the class variables. Now define a Copy Constructor: The constructor that you will write will be a copy constructor that uses the parameter LandTract object to make a duplicate LandTract object, by copying the...
Question 4: CLO5 Write a class called Rectangle that has length and width as instance variables, a constructor with two parameter to initialize length and width, set and get methods for each variables and the following methods: a. The first method calculates and returns the value of the ratio of the length to the width of the rectangle. b. The second method determines whether a rectangle is a Square depending on the value of the ratio, which should be calculated...
C++ program. int main() { Rectangle box; // Define an instance of the Rectangle class double rectWidth; // Local variable for width double rectLength; // Local variable for length string rectColor; // Get the rectangle's width and length from the user. cout << "This program will calculate the area of a\n"; cout << "rectangle. What is the width? "; cin >> rectWidth; cout << "What is the length? "; cin >>...
Two-dimensional arrays and functions Write the code CIS22A-HW7-XXXXX.cpp to create and print a 12 x 12 multiplication table using a 2-dimensional array and functions with nested loops. Define the following Global Constants at the top, before main function: const int ROW_SIZE = 12; const int COL_SIZE = 12; const int WIDTH = 4; Two required functions are: void createTable(int [][COL_SIZE], int rows); void printTable(int [][COL_SIZE], int rows); Use this main code without any change: int main() { int table[ROW_SIZE]...
Creating a Class in C++ Summary In this lab, you create a programmer-defined class and then use it in a C++ program. The program should create two Rectangle objects and find their area and perimeter. Instructions Ensure the class file named Rectangle.cpp is open in your editor. In the Rectangle class, create two private attributes named length and width. Bothlength and width should be data type double. Write public set methods to set the values for lengthand width. Write public...
In Java please! Problem You will be using the point class discussed in class to create a Rectangle class. You also need to have a driver class that tests your rectangle. Requirements You must implement the 3 classes in the class diagram below and use the same naming and data types. Following is a description of what each method does. Point Rectangle RectangleDriver - x: int - top Left: Point + main(args: String[) - y: int - width: int +...