# Homework Solution: C# – Printing the return value of a method within a class to the console….

C# - Printing the return value of a method within a class to the console. Please see the ******* part for what I am trying to do. Could you also please explain what I was doing wrong with my main method. using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace DiceRoller { public class Die { static void Main(string[] args) { ***** I want to do Console.WriteLine here that displays the returned value in GetFaceValue() Console.ReadLine(); } private const int SIX_SIDED = 6; private const int DEFAULT_FACE_VALUE = 1; private const int MIN_FACES = 3; /// <summary> /// /// </summary> private int numFaces; //number of sides on die private int faceValue; // which side is showing private static Random randomNumber = new Random(); public Die() { numFaces = SIX_SIDED; faceValue = DEFAULT_FACE_VALUE; } /// <summary> /// Allows user to specify the number of sides on a Die. /// If "faces" is less than 3, a six-sided die is instantiated. /// </summary> /// <param name="faces"> the numberr of sides</param> public Die(int faces) { if (faces >= MIN_FACES) { numFaces = faces; } else { numFaces = SIX_SIDED; } RollDie(); } /// <summary> /// Simulates the rolling of a Die. /// </summary> public void RollDie() { faceValue = randomNumber.Next(1, numFaces + 1); } // end RollDie /// <summary> /// Die accessor /// </summary> /// <returns> The current face of the Die</returns> public int GetFaceValue() { return faceValue; } //end GetFaceValue }// end Class Die }

Hi let me know if you need more information:- ==================================== 1.C# - Printing the return value of a method within a class to the console.

C# – Printing the retaliate treasure of a way amid a arrange to the encourage.

Fascinate beware the ******* multiply control what I am enigmatical to do. Could you to-boot fascinate clear-up what I was doing wickedness with my deep way.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DiceRoller
{
public arrange Sink
{
static unoccupied Deep(string[] args)
{
***** I neglect to do Encourage.WriteLine here that displays the retaliateed treasure in GetFaceValue()
}
private const int SIX_SIDED = 6;
private const int DEFAULT_FACE_VALUE = 1;
private const int MIN_FACES = 3;
/// <summary>
///
/// </summary>
private int numFaces; //compute of interests on sink
private int aspectValue; // which interest is showing
private static Random randomCompute = odd Random();

public Sink()
{
numFaces = SIX_SIDED;
faceTreasure = DEFAULT_FACE_VALUE;
}

/// <summary>
/// Allows user to determine the compute of interests on a Sink.
/// If “faces” is near than 3, a six-sided sink is instantiated.
/// </summary>
/// <param name=”faces”> the computer of interests</param>
public Sink(int aspects)
{

if (faces >= MIN_FACES)
{
numFaces = aspects;
}
else
{
numFaces = SIX_SIDED;
}

RollDie();
}

/// <summary>
/// Simulates the rolling of a Sink.
/// </summary>
public unoccupied RollDie()
{
faceTreasure = randomNumber.Next(1, numFaces + 1);
} // purpose RollDie

/// <summary>
/// Sink accessor
/// </summary>
/// <returns> The running aspect of the Sink</returns>
public int GetFaceValue()
{
retaliate aspectValue;
} //purpose GetFaceValue

}// purpose Arrange Sink
}

## Expert Repartee

Hi allow me apprehobject if you demand further information:-

====================================

1.C# – Printing the retaliate treasure of a way amid a arrange to the encourage.

Repartee :- Encourage.WriteLine(“{0}”,die.GetFaceValue());

2. static unoccupied Deep(string[] args) { it must be affect below

Repartee :- public static unoccupied Deep(string[] args) {

======================================================

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DiceRoller
{
public arrange Sink
{
public static unoccupied Deep(string[] args)
{
***** I neglect to do Encourage.WriteLine here that displays the retaliateed treasure in GetFaceValue()

Sink sink = odd Sink();

Console.WriteLine(“{0}”,die.GetFaceValue());
}
private const int SIX_SIDED = 6;
private const int DEFAULT_FACE_VALUE = 1;
private const int MIN_FACES = 3;
/// <summary>
///
/// </summary>
private int numFaces; //compute of interests on sink
private int aspectValue; // which interest is showing
private static Random randomCompute = odd Random();

public Sink()
{
numFaces = SIX_SIDED;
faceTreasure = DEFAULT_FACE_VALUE;
}

/// <summary>
/// Allows user to determine the compute of interests on a Sink.
/// If “faces” is near than 3, a six-sided sink is instantiated.
/// </summary>
/// <param name=”faces”> the computer of interests</param>
public Sink(int aspects)
{

if (faces >= MIN_FACES)
{
numFaces = aspects;
}
else
{
numFaces = SIX_SIDED;
}

RollDie();
}

/// <summary>
/// Simulates the rolling of a Sink.
/// </summary>
public unoccupied RollDie()
{
faceTreasure = randomNumber.Next(1, numFaces + 1);
} // purpose RollDie

/// <summary>
/// Sink accessor
/// </summary>
/// <returns> The running aspect of the Sink</returns>
public int GetFaceValue()
{
retaliate aspectValue;
} //purpose GetFaceValue

}// purpose Arrange Sink
}

Fascinate perceive bolder gratified.

——————–

OUTPUT:-

————–

1

..etc
as per limitation you can alter the program.

==================================
{"ft_lang_label":"__label__en","ft_lang_prob":0.56417626,"math_prob":0.8777405,"size":3643,"snap":"2020-45-2020-50","text_gpt3_token_len":870,"char_repetition_ratio":0.15169002,"word_repetition_ratio":0.7859922,"special_character_ratio":0.3066154,"punctuation_ratio":0.15514019,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9547464,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-11-26T17:42:02Z\",\"WARC-Record-ID\":\"<urn:uuid:05d246d2-8597-46fb-8a44-ae2686eae3f2>\",\"Content-Length\":\"89826\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:7341a88c-8556-4001-abd6-5ca9523db4f1>\",\"WARC-Concurrent-To\":\"<urn:uuid:a0aa1e74-9f99-45bc-8b98-f233d9ad3da8>\",\"WARC-IP-Address\":\"185.61.154.31\",\"WARC-Target-URI\":\"https://liusson.com/homework-solution-c-printing-the-return-value-of-a-method-within-a-class-to-the-console/\",\"WARC-Payload-Digest\":\"sha1:VBLQAC6AD5TDO4D2CU6OFNLDMSSD5QFN\",\"WARC-Block-Digest\":\"sha1:Y7DDLQXQHH52BRME6B5SEQ4IURWKGGDR\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-50/CC-MAIN-2020-50_segments_1606141188899.42_warc_CC-MAIN-20201126171830-20201126201830-00664.warc.gz\"}"}