Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

using System; namespace Lab_Exercise_4 { class Square // the definition of the Square class { private int CornerX; private int CornerY; private int Side; public

image text in transcribed

using System; namespace Lab_Exercise_4 { class Square // the definition of the Square class { private int CornerX; private int CornerY; private int Side; public Square(int valueX, int valueY, int valueS) // the constructor allowing initialisation { CornerX = valueX; CornerY = valueY; Side = valueS; } public int X // the three properties allowing access to the specs { get { return CornerX; } } public int Y { get { return CornerY; } } public int S { get { return Side; } } } // The main part of the program // Please make sure all values "unknown" are replaced by the correct numerical answers class Program { static void Main(string[] args) { Random rnd = new Random(); // initialisation of the random number generator string unknown = "unknown"; // declaration of "unknown" Square square1 = new Square(rnd.Next(100), rnd.Next(100), rnd.Next(100)); // creation of an object square1 Square square2 = new Square(rnd.Next(100), rnd.Next(100), rnd.Next(100)); // creation of an object square2 // Report the specificatons of both squares Console.WriteLine($"The bottom left corner of square 1 is: ({square1.X},{square1.Y}) and its side is: {square1.S}"); Console.WriteLine($"The bottom left corner of square 2 is: ({square2.X},{square2.Y}) and its side is: {square2.S}"); // Compute and report the top right corners of both squares Console.WriteLine($"The top right corner of square 1 is: ({unknown},{unknown})"); Console.WriteLine($"The top right corner of square 2 is: ({unknown},{unknown})"); // Projections on the X axis of both squares Console.WriteLine($"The projection of square 1 on X axis is: ({unknown},{unknown})"); Console.WriteLine($"The projection of square 2 on X axis is: ({unknown},{unknown})"); // Compute and report the size/length of the overlap of X axis projections Console.WriteLine($"The size of the overlap on X axis is: ({unknown})"); // Compute and report projections on the Y axis of both squares Console.WriteLine($"The projection of square 1 on Y axis is: ({unknown},{unknown})"); Console.WriteLine($"The projection of square 2 on Y axis is: ({unknown},{unknown})"); // Compute and report the size/length of the overlap of X axis projections Console.WriteLine($"The size of the overlap on Y axis is: ({unknown})"); // Compute and report the size of the area of the overlap Console.WriteLine($"The size/area of the overlap is: ({unknown})"); } } }
Your task in this Lab Exercise is to practice simple manipulation of objects combined with prompting users for input, getting input in from the users, storing user input in variables, using if statements. This is a 'code rewriting'-type exercise. You'll start with source code that we provide, and you make all necessary alterations. Your task in this Lab Exercise is to practice simple manipulation of objects combined with prompting users for input, getting input in from the users, storing user input in variables, using if statements. This is a 'code rewriting'-type exercise. You'll start with source code that we provide, and you make all necessary alterations

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_2

Step: 3

blur-text-image_3

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

Multidimensional Array Data Management In Databases

Authors: Florin Rusu

1st Edition

1638281483, 978-1638281481

More Books

Students also viewed these Databases questions

Question

What is a verb?

Answered: 1 week ago