PLEASE DO IN C# AND MAKE SURE I CAN COPY CODE INTO VISUAL STUDIO
Exercise#1:DesignandimplementclassCircletorepresentacircleobject.Theclassdefinesthefollowingattributes(variables)andmethods:
ThecirclehasradiusX. WhereXisthevalueofvariableradius.
Nowdesignandimplementatestprogramtocreateadefaultcircleobjectandtestallclassmethodsontheobject.Printtheobjectaftereachmethodcallandusemeaningfullabelforeachmethodcallasshowninthefollowingsamplerun.
Samplerun:
Printradius:
Theradiusis1.
Printarea:
Theareais3.14
Printperimeter:
Theperimeteris6.28
Setradiusto10andprinttheobject:Thecirclehasradius10.
Printarea:
Theareais314.23
Printperimeter:
Theperimeteris62.81
SOURCE CODE:
using System;
public class Circle
{
private double radius;
public Circle() //Constructor
{
radius=0.0;
}
public Circle(double r) //Constructor parameterised
{
radius=r;
}
public double getRadius()
{
return radius;
}
public void setRadius(double r)
{
radius=r;
}
public double getArea()
{
return radius*radius*3.14;
}
public double getPerimeter()
{
return 2*3.1459*radius;
}
public void toString()
{
Console.WriteLine("The Circle has radius {0}. Where {1} is the
value of variable radius.",radius,radius);
}
}
class HelloWorld // Class to implement above class.
{
static void Main() {
Circle c1=new Circle(1.0); // Creating class object.
Console.WriteLine("Print radius:");
Console.WriteLine("The radius is {0}.",c1.getRadius());
Console.WriteLine("Print Area:");
Console.WriteLine("The area is
{0}.",Math.Round(c1.getArea(),2));
Console.WriteLine("Print getPerimeter:");
Console.WriteLine("The area is
{0}.",Math.Round(c1.getPerimeter(),2));
Console.Write("Set radius to 10.");
c1.setRadius(10.0);
Console.WriteLine("The Circle has radius
{0}.",c1.getRadius());
Console.WriteLine("Print Area:");
Console.WriteLine("The area is
{0}.",Math.Round(c1.getArea(),2));
Console.WriteLine("Print getPerimeter:");
Console.WriteLine("The area is
{0}.",Math.Round(c1.getPerimeter(),2));
}
}
OUTPUT

PLEASE DO IN C# AND MAKE SURE I CAN COPY CODE INTO VISUAL STUDIO Exercise#1:DesignandimplementclassCircletorepresentacircleobject.Theclassdefinesthefollowingattributes(variables)andmethods: Aprivatevariableoftypedoublenamedradiustorepresenttheradius.Se
PLEASE DO IN C# AND MAKE SURE I CAN COPY CODE IN VISUAL STUDIO Exercise #1: Design and implement class Rectangle to represent a rectangle object. The class defines the following attributes (variables) and methods: 1. Two Class variables of type double named height and width to represent the height and width of the rectangle. Set their default values to 1.0 in the default constructor. 2. A non-argument constructor method to create a default rectangle. 3. Another constructor method to...
PLEASE DO IN C# AND MAKE SURE I CAN COPY CODE IN VISUAL STUDIO Program 2: Design (pseudocode) and implement (source code) a class called Counter. It should have one private instance variable representing the value of the counter. It should have two instance methods: increment() which adds on to the counter value and getValue() which returns the current value. After creating the Counter class, create a program that simulates tossing a coin 100 times using two Counter objects (Head...
PLEASE DO IN C# AND MAKE SURE I CAN COPY COPY CODE INTO VISUAL STUDIO Now, complete the provided “main” method by calling the previous method (“SortArray”). Display the contents of your array before and after the method call. A simple example of the output is provided below: Arrays Values before Sorting: Value at: [0] is: 11 Value at: [1] is: 4 Value at: [2] is: 44 Value at: [3] is: 14 Value at: [4] is: 5 Sorted Arrays Values:...
PLEASE DO IN C# AND MAKE SURE I CAN COPY CODE IN VISUAL STUDIO Program 2: Design (pseudocode) and implement (source code) a program (name it FeetMeters) to display a conversion tables for feet and meter as show below. Document your code and properly. Feet Meter 1.0 0.305 2.0 0.610 3.0 0.915 . . . . . . 19.0 5.7.95 20.0 6.100 Meter Feet 1.0 3.279 2.0 6.558 3.0 9.837 . . . . . . 19.0 62.301 20.0 65.574...
URGENT ! PLEASE DO IN C# AND MAKE SURE I CAN COPY COPY CODE INTO VISUAL STUDIO Define a method named SortArray() to sort a one dimensional array of integers. YOU MAY NOT CALL A BUILT-IN SORTING FUNCTION, but should write your own. The method should return the sorted array. You may use whichever sorting algorithm you prefer, in order to sort the array. Please initialize an array and fill it with random values before beginning. Ensure that it has...
PLEASE DO IN C# AND MAKE SURE I CAN COPY CODE INTO VISUAL STUDIO Exercise #2: Design and implement a program (name it CompareArrays) that compares the content of 2 single-dimensional arrays of the same size. The program prompts the users to enter the array size. Then prompts the user to initialize each array with integer values. The program defines method Compare() that takes two signal-dimensional arrays of type integer. The method compares the content of the arrays and returns...
PLEASE DO IN C# AND MAKE SURE I CAN COPY CODE INTO VISUAL STUDIO Program 4: A palindromic prime number is a number that is both prime number and a palindrome number. For example, 131, 313, and 757 are palindromic prime numbers. Design (pseudocode) and implement (source code) a program (name it PalindromicPrime) to display the first 50 palindromic prime numbers, 10 per line separated by one space. The program defines the following methods: Method isPalindome() to check if a...
Second time posting please answer this question!!! Thankyou!! Please do it in visual studio C # and post copy of form.cs and designer.cs. Will give vgood review!!! In this module you learned about Classes and Multiforms. You will be completing one program for this module Write a class named Car that has the following member variables: year - An int that holds the car’s model year. make - A string object that holds the make of the car. speed -...
using visual studios C# implementing using system; be sure I can copy and paste. Exercise #2: Design and implement class Radio to represent a radio object. The class defines the following attributes (variables) and methods: Assume that the station and volume settings range from 1 to 10. 1. A private variable of type int named station to represent a station number. Set to 1. 2. A private variable of type int named volume to represent the volume setting. Set to...
PLEASE DO BOTH OF THESE IN PYTHON!!! AND MAKE SURE THAT I CAN COPY THE CODE. 1.) Exercise #1: Design and implement a program (name it PrintSum) that prompts the user for an integer values between 1 and 100. The program then uses a while loop to determine and print out the sum of all values between 1 and the entered value. The program rejects invalid input values with proper message such “Invalid Input. Try again.” Document your code and...