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

Please use original C++ code for this. This is for visual studio. Program 5: Shipping Calculator...
Please use original C++ code for this. This is for visual studio. Program 5: Shipping Calculator The Speedy Shipping Company will ship packages based on how much they weigh and how far they are being sent. They will only ship small packages up to 10 pounds. You have been tasked with writing a program that will help Speedy Shipping determine how much to charge per delivery. The charges are based on each 500 miles shipped. Shipping charges are not pro-rated;...
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...
Code: please use in visual studio 2019 c++ (not java) In total you will write 6...
Code: please use in visual studio 2019 c++ (not java) In total you will write 6 functions: Functions : A ) addInts, returns int; input is two ints; Add the values of the two parameters and return the sum B) subInts , returns int; input is two ints; Subtract the values of the two parameters and return the difference C) multInts, returns int; input is two ints; multiple the values of the two parameters and return the product D) divInts,...
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...
ONLY USE VISUAL STUDIO (NO JAVA CODING) VISUAL STUDIO -> C# -> CONSOLE APPLICATION In this...
ONLY USE VISUAL STUDIO (NO JAVA CODING) VISUAL STUDIO -> C# -> CONSOLE APPLICATION In this part of the assignment, you are required to create a C# Console Application project. The project name should be A3<FirstName><LastName>P2. For example, a student with first name John and Last name Smith would name the project A1JohnSmithP2. Write a C# (console) program to calculate the number of shipping labels that can be printed on a sheet of paper. This program will use a menu...
 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...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT