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.
Ok, what is your question?
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.
|All times are GMT +1. The time now is 05:09 AM.|
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.