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.
// 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;
}
}
Comments
Leave a comment