Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Dec 2012
    Thanked 1 Time in 1 Post

    Help but do NOT consideri it as cheating

    (The Fan class)
    Design a class named Fan to represent a fan. The class contains:

    Three static public constants named Slow, Medium and Fast with values 1, 2 and 3 to denote the fan speed. "Note that "public int constant" is error".

    A private int data field named that specifies the speed of the fan (default Slow).
    A private bool data field on that specifies whether the fan is on (default false).
    A private double radius (default 5).
    A private string color blue (default blue).
    A properties for all 4 data fields.

    No-arg constructor that creates a default fan. Use this ref. // I think it is like Public class Fan:this(Slow, false, 5, "Blue").

    1-are constructor that creates a fan. Provide speed value.
    2-arg constructor that creates a fan. Provide speed and on values.
    3-arg constructor that creates a fan, Provide speed, on and radius values.
    4-arg constructor that creates a fan. Provide speed, on, radius and color values.

    A method named DisplayFan() that returns a string description for the fan. If the fan is on, the method returns the fan speed, color and radius in one combined string. If the fan is not on, the method returns fan color and radius along with the string "fan is off' in one combined string.

    Write a test program that creates 2 Fan objects. Assign maximum speed, radius 10, color yellow and turn it on the first object. Assign medium speed, radius 5, color blue and turn it off to the second object. Display the objects by invoking their DisplayFan method.

    Using C#.

  2. #2
    Rockstar Coder
    Join Date
    Jun 2002
    Thanked 328 Times in 324 Posts
    Ok, what is your question?

  3. #3
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Sydney, Australia
    Thanked 932 Times in 919 Posts
    If your code isn't working then we'd need to see what code you have in order to be able to provide any help. You should at least have made an effort to create all of the properties and methods asked for prior to asking for help.
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  4. #4
    Senior Coder alykins's Avatar
    Join Date
    Apr 2011
    Thanked 210 Times in 209 Posts
    Quote Originally Posted by Dev Hawk View Post

    No-arg constructor that creates a default fan. Use this ref. // I think it is like Public class Fan:this(Slow, false, 5, "Blue").
    This is the only part I see you did any work- without giving too much away....
        class Program
            static void Main(string[] args)
                fan f = new fan();
        public class fan
            private string PretendValue;
            private int PretendValue2;
            public fan()
                PretendValue = "cat";
                PretendValue2 = 5;
            private void display()
                Console.WriteLine("{0}, {1}\nfin...", PretendValue, PretendValue2);
    I do believe that will give you a lot to work with

    I code C hash-tag .Net
    Reference: W3C W3CWiki .Net Lib
    Validate: html CSS
    Debug: Chrome FireFox IE


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts