In: Computer Science
Please code in C#-Visual Studio
Tasks
Feedback rubric
Value |
Problem |
Points |
1 |
No comment header |
10 |
2 |
Variable type mismatch |
2 per variable |
3 |
Areas and perimeters do not match inputs |
20 |
4 |
Program crashes or does not compile |
20 |
5 |
No .cs file uploaded |
30 |
L |
Late |
20 |
Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AreaPerimeter
{
class Program
{
static void Main(string[] args)
{
string name;
double lenght, width,recangleArea,recanglePerimeter;
int squareLength,squareArea,squarePerimetere;
Console.Write("Enter your name: ");
name = Console.ReadLine();
Console.Write("Enter the length of rectangle: ");
lenght=Convert.ToDouble(Console.ReadLine());
Console.Write("Enter the width of rectangle: ");
width = Convert.ToDouble(Console.ReadLine());
Console.Write("Enter the length of square: ");
squareLength = Convert.ToInt32(Console.ReadLine());
recangleArea = width * lenght;
recanglePerimeter = 2 * (lenght + width);
squareArea = squareLength * squareLength;
squarePerimetere = 4 * squareLength;
Console.WriteLine("\n\nName: " + name);
Console.WriteLine("Area of a rectangle :" + recangleArea);
Console.WriteLine("Perimeter of a rectangle : " +
recanglePerimeter);
Console.WriteLine("Area of a square :" + squareArea);
Console.WriteLine("Perimeter of a square : " +
squarePerimetere);
Console.ReadKey();
}
}
}
output
If you have any query regarding the code please ask me in the
comment i am here for help you. Please do not direct thumbs down
just ask if you have any query. And if you like my work then please
appreciates with up vote. Thank You.