Answer to Question #345210 in C# for typre

Question #345210

1. Create a method named getCircleDiameter that takes a radius of double type as the parameter. The method should return the diameter of a circle. To compute the diameter of a circle, multiply the radius by 2.



2.Create a struct named Product where its fields are code, description, and price.


Create a class named Person with an instance variable named full_name. Declare one (1) constructor without a parameter and initialize the variable with a default value.



3.Create a class named Account with an instance variable named account_number. Make this class a member of the Accounts namespace.

1
Expert's answer
2022-05-26T14:08:26-0400
// Create a method named getCircleDiameter that takes a radius of double type as the parameter. The method should return the diameter of a circle. To compute the diameter of a circle, multiply the radius by 2.
public double getCircleDiameter(double radius)
{
    return radius * 2;
}
// Create a struct named Product where its fields are code, description, and price.
public struct Product
{
    public int code;
    public string description;
    public double price;
}
// Create a class named Person with an instance variable named full_name. Declare one (1) constructor without a parameter and initialize the variable with a default value.
public class Person
{
  public string full_name;
  public Person()
  {
    full_name = "John Smith";
  }
}
// Create a class named Account with an instance variable named account_number. Make this class a member of the Accounts namespace.
namespace Accounts
{
    public class Account
    {
        public int account_number;
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS