Question

In: Computer Science

Please code in C#-Visual Studio Tasks The program needs to contain the following A comment header...

Please code in C#-Visual Studio

Tasks

  1. The program needs to contain the following
    1. A comment header containing your name and a brief description of the program
    2. Output prompting the user for the following inputs:
      1. Name as a string
      2. Length of a rectangle as a double
      3. Width of a rectangle as a double
      4. Length of a square as an int
    3. After accepting user input, the program outputs the following:
      1. User name
      2. Area of a rectangle with dimensions matching the inputs
        • Area of a rectangle = Length * Width
      3. Perimeter of a rectangle with dimensions matching the inputs
        • Perimeter of a rectangle = (2 * length) + (2 * Width)
      4. Area of a square with dimensions matching the inputs
        • Area of a square = Length * Length
      5. Perimeter of a square with dimensions matching the inputs
        • Area of a square = 4 * length
    4. “Press enter to continue”
    5. ConsolRead(); at the end of your code
  2. Upload the completed .cs file onto the Assignment 2 submission folder. To access the .cs file:
    1. Right click on your program tab
    2. Click “Open containing folder”
    3. The file you are working on will be there with a .cs extention, upload the .cs file

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

Solutions

Expert Solution

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.


Related Solutions

I need the code for following in C++ working for Visual studio please. Thanks Use a...
I need the code for following in C++ working for Visual studio please. Thanks Use a Struct to create a structure for a Player. The Player will have the following data that it needs maintain: Struct Player int health int level string playerName double gameComplete bool isGodMode Create the 2 functions that will do the following: 1) initialize(string aPlayerName) which takes in a playername string and creates a Player struct health= 100 level= 1 playerName = aPlayerName gameComplete = 0...
C++ PROGRAM Using the attached C++ code (Visual Studio project), 1) implement a CoffeeMakerFactory class that...
C++ PROGRAM Using the attached C++ code (Visual Studio project), 1) implement a CoffeeMakerFactory class that prompts the user to select a type of coffee she likes and 2) returns the object of what she selected to the console. #include "stdafx.h" #include <iostream> using namespace std; // Product from which the concrete products will inherit from class Coffee { protected:    char _type[15]; public:    Coffee()    {    }    char *getType()    {        return _type;   ...
answer the following using C# Design and program a Visual Studio Console project in C# that...
answer the following using C# Design and program a Visual Studio Console project in C# that allows your user to enter a number. The program will examine the number to see if it is prime. If it is prime, it will print the next higher prime and the next lower primes to the console. If the number entered by the user is not prime, display a message to that effect. All code should be written by you. Do not copy/paste...
In visual Studio C++ Create a program that uses a for loop to input the high...
In visual Studio C++ Create a program that uses a for loop to input the high temperature, and low temperature for each day of the week. The high and low will be placed into two elements of the array. For each loop the high and low will be placed into the next set of elements of the array. After the temps for all seven days have been entered into the array, a for loop will be used to pull out...
String Manipulator Write a program to manipulate strings. (Visual Studio C++) In this program take a...
String Manipulator Write a program to manipulate strings. (Visual Studio C++) In this program take a whole paragraph with punctuations (up to 500 letters) either input from user, initialize or read from file and provide following functionalities within a class: a)   Declare class Paragraph_Analysis b)   Member Function: SearchWord (to search for a particular word) c)   Member Function: SearchLetter (to search for a particular letter) d)   Member Function: WordCount (to count total words) e)   Member Function: LetterCount (ONLY to count all...
USING VISUAL STUDIO 2017, LANGUAGE VISUAL C# I have struggled on this program for quite some...
USING VISUAL STUDIO 2017, LANGUAGE VISUAL C# I have struggled on this program for quite some time and still can't quite figure it out. I'm creating an app that has 2 textboxes, 1 for inputting customer name, and the second for entering the number of tickets the customer wants to purchase. There are 3 listboxes, the first with the days of the week, the second with 4 different theaters, and the third listbox is to display the customer name, number...
 VISUAL STUDIO (File Creation and Submissions)  FLOWCHART  Writing program in C++ ( cout,...
 VISUAL STUDIO (File Creation and Submissions)  FLOWCHART  Writing program in C++ ( cout, \n, \t, solving expressions )  Correcting errors Q1: Draw flow Chart of the following problems: a) Display “Hello World” on screen. b) Display Your Name, date of birth and mobile number on screen. c) Compute and display the perimeter and area of a rectangle with a height of 7 inches and width of 5 inches. d) Compute and display the perimeter and area...
write a c++ program using micro soft visual studio 2010 to write a program and store...
write a c++ program using micro soft visual studio 2010 to write a program and store 36 in variable x and 8 in variable y. add them and store the result in the variable sum. then display the sum on screen with descriptive text. calculate the square root of integer 36 in x. store the result in a variable. calculate the cube root of integer 8 in y. store result in a variable. display the results of square root and...
PS: Please don't use #include <bits/stdc++.h>. Visual studio compatible please. Write a C++ program to find...
PS: Please don't use #include <bits/stdc++.h>. Visual studio compatible please. Write a C++ program to find least common multiple (LCM) of two, three and four integer values. The integer values are entered from the keyboard and the outputs are printed to the console. The LCM of two, three and four integer values are computed using Prime factorization method. You have to use arrays to hold input values and use functions/methods to get data from the keyboard, display output to the...
Use the functions.h header file with your program (please write in C code): #ifndef FUNCTIONS_H #define...
Use the functions.h header file with your program (please write in C code): #ifndef FUNCTIONS_H #define FUNCTIONS_H typedef struct MyStruct { int value; char name[ 100 ]; } MyStruct; void sortArray( MyStruct*, int ); void printArray( MyStruct*, int ); #endif Create a source file named functions.c with the following: A sorting function named sortArray. It takes an array of MyStruct's and the length of that array. It returns nothing. You can use any of the sorting algorithms, you would like...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT