o Add another class for the Square and display its area, users must also input its values needed to display the area.
o Add another class for the Square and display its area, users must also input its values needed to display the area.
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
![Creating Simple Databases Using OOP
Inheritance and Polymorphism
Objectives:
At the end of the exercise, the students should be
able to:
• Create a C# program with classes to
incorporate 00OP concepts.
Procedures:
1. This is a group activity, your group will be from
your ILS (PR groupings).
2. Using a computer with an installed copy of
Visual Studio that has Visual C# and an
Internet connection for the online IDE, using
the program from the 06 LMS Homework 1:
o Modify it so that it will accept input
from the user to compute the areas.
o Add another class for the Square and
display its area, users must also input
its values needed to display the area.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F9e992334-5236-44bb-9a29-a6bba7555b46%2Fb473cc8e-4b87-43fb-a4e7-e850abefc6a9%2Ffdvgm7b_processed.jpeg&w=3840&q=75)
Transcribed Image Text:Creating Simple Databases Using OOP
Inheritance and Polymorphism
Objectives:
At the end of the exercise, the students should be
able to:
• Create a C# program with classes to
incorporate 00OP concepts.
Procedures:
1. This is a group activity, your group will be from
your ILS (PR groupings).
2. Using a computer with an installed copy of
Visual Studio that has Visual C# and an
Internet connection for the online IDE, using
the program from the 06 LMS Homework 1:
o Modify it so that it will accept input
from the user to compute the areas.
o Add another class for the Square and
display its area, users must also input
its values needed to display the area.
![Square.cs
Program cs* x
ainheritanceApplication
- mertanceApplicatien.Pregram
-, Mainistringl args)
1 Busing System;
using System. Callectiors.Gereic;
using System. Ling;
using System. Text;
using System. Threading. Tasks;
2
Bnamespace Inheritancekpplication
9
class Program
10
11
static void Main(string[] args)
12
IShape r. nex Rectangle(3, 2);
r.get Ares ();
IShape c = neN Circle(2);
c.get Area ();
Console. Readkey ();
13
14
15
16
17
18
19
20
interface IShape
21
22
void getarea();
23
24
atstract class Shape : IShape
25
protected int width, height;
protected couble pie, radius;
public abstract void getarea();
public Snape()
26
27
28
29
30
Console. Writeline("Inheritarce Implementation");
31
32
33
34
class Rectangle : Shape
35
private double area;
public Rectangle(int w, int h)
36
37
38
width • w;
height = h;
Console.uriteline("Area of a Rectangle");
39
40
41
42
43 6
public orerride vaid getarea()
44
area - width height;
Console. Writeline(*Area - Nicth + Height");
Console. Writelinel"Area -"+ wioth + ""+
Corsole.Mriteline("Area "+ area);
Console. Writeline();
45
46
47
height);
48
49
50
51
52
class Circle : Shape
53
54
private double area;
55
public Circle(couble r)
56
pie = 2.14;
radius - r;
Console. writeiire("frea of a circle");
57
58
59
60
61
public override void getarea()
62
area - pie * (radius * radius);
Corsole. Writeline("Area = Pie * (Radius * Radius)");
Consale.Writeline("Area ="+ pie +* (" + radius +"**+ radius + ")");
Corsole. Writeline("Area = "+ area);
Console.Writelire();
63
54
65
66
67
68
69
70
71
Git Changes Properties
Solution Explorer Git Changes Properties
Server Explorer Toolbo](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F9e992334-5236-44bb-9a29-a6bba7555b46%2Fb473cc8e-4b87-43fb-a4e7-e850abefc6a9%2F7lzm3c8_processed.jpeg&w=3840&q=75)
Transcribed Image Text:Square.cs
Program cs* x
ainheritanceApplication
- mertanceApplicatien.Pregram
-, Mainistringl args)
1 Busing System;
using System. Callectiors.Gereic;
using System. Ling;
using System. Text;
using System. Threading. Tasks;
2
Bnamespace Inheritancekpplication
9
class Program
10
11
static void Main(string[] args)
12
IShape r. nex Rectangle(3, 2);
r.get Ares ();
IShape c = neN Circle(2);
c.get Area ();
Console. Readkey ();
13
14
15
16
17
18
19
20
interface IShape
21
22
void getarea();
23
24
atstract class Shape : IShape
25
protected int width, height;
protected couble pie, radius;
public abstract void getarea();
public Snape()
26
27
28
29
30
Console. Writeline("Inheritarce Implementation");
31
32
33
34
class Rectangle : Shape
35
private double area;
public Rectangle(int w, int h)
36
37
38
width • w;
height = h;
Console.uriteline("Area of a Rectangle");
39
40
41
42
43 6
public orerride vaid getarea()
44
area - width height;
Console. Writeline(*Area - Nicth + Height");
Console. Writelinel"Area -"+ wioth + ""+
Corsole.Mriteline("Area "+ area);
Console. Writeline();
45
46
47
height);
48
49
50
51
52
class Circle : Shape
53
54
private double area;
55
public Circle(couble r)
56
pie = 2.14;
radius - r;
Console. writeiire("frea of a circle");
57
58
59
60
61
public override void getarea()
62
area - pie * (radius * radius);
Corsole. Writeline("Area = Pie * (Radius * Radius)");
Consale.Writeline("Area ="+ pie +* (" + radius +"**+ radius + ")");
Corsole. Writeline("Area = "+ area);
Console.Writelire();
63
54
65
66
67
68
69
70
71
Git Changes Properties
Solution Explorer Git Changes Properties
Server Explorer Toolbo
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Recommended textbooks for you
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
![Concepts of Database Management](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY