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...
icon
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.
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
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
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
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…
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)
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
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY