Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

*** Please in Java & comment if possible thank you!*** Part 1. Write a Java class called Square that represents a rectangular two-dimensional region Your

*** Please in Java & comment if possible thank you!***

image text in transcribed

image text in transcribed

Part 1. Write a Java class called Square that represents a rectangular two-dimensional region Your Square objects should have the following instance variables int sideLength; int xPosition; int yPosition; have following methods public void setSideLength (int newLength) //set the value of sideLength public int getSideLength () //Return the value of side length public int getX () / /Return the value of xPosition public int gety () / /Returns the value of yPosition public String tostring () / /Return a string representation of this Square, such as "Square [x=3, y=4, side -34]" Part 2. Write a client program called SquareClient that creates objects of the Square class called squarel and square2, so that squarel has a side length 7 and xPosition equal to 5; yPosition equal to 9 square2 has a side length 21 and xPosition equal to 14: yPosition equal to 17 Print out these Square obiects using System out.println method (System.out.println(square1):) Hints: . You should create 2 source files for this assignment: o Square java Square class implementation goes here (part 1) SquareClient.java- here, you create instances and assign the values in the main0 method (part 2); o .Feel free to use slides (2_Classes on iCollege) as a reference

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke

4th Edition

0136086535, 9780136086536

More Books

Students also viewed these Databases questions