are my getters and setters correct?
Before I work on the rest of my code, please let me know if there are any errors in my getters and setters
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
public class Menu
{
private string dishName;
private int dishType, dishPrice;
//def constructor
class Menu() { }
//const with param
public Menu(String dishName, int dishType, int dishPrice)
{
SetName(dishName);
SetType(dishType);
SetPrice(dishType);
}
//GETTERS
/ Returns the name of the dish.
@return: dish name
*/
public void GetName() { return dishName; }
/ Returns the type of dish ordered.
@return: returns either appetizer, entree, or dessert
*/
public int GetType() { return dishType; }
/ Returns the height of the rectangle.
@return: height of the rectangle
*/
public interface GetPrice() { returns dishPrice; }
//SETTERS
/ Updates name of dish.
@param width: the updated dish name
*/
public void SetName(string dishName) { this.Name = dishName; }
/ Updates the type of dish.
@param width: the updated dish type
*/
public void SetType(string dishType) { this.Type = dishType; }
/ Updates the type of dish.
@param width: the updated dish type
*/
public void SetPrice(string dishPrice) { this.Price = dishPrice; }
public override string ToString() { return string.Format(dishName + "(" + dishPrice + ")", GetName(), GetPrice()); }
}
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
public class Menu
{
private string dishName;
private int dishType, dishPrice;
//def constructor
class Menu() { }
//const with param
public Menu(String dishName, int dishType, int dishPrice)
{
SetName(dishName);
SetType(dishType);
SetPrice(dishType);
}
//GETTERS
/ Returns the name of the dish.
@return: dish name
*/
public void GetName() { return dishName; }
/ Returns the type of dish ordered.
@return: returns either appetizer, entree, or dessert
*/
public int GetType() { return dishType; }
/ Returns the height of the rectangle.
@return: height of the rectangle
*/
public interface GetPrice() { returns dishPrice; }
//SETTERS
/ Updates name of dish.
@param width: the updated dish name
*/
public void SetName(string dishName) { this.Name = dishName; }
/ Updates the type of dish.
@param width: the updated dish type
*/
public void SetType(string dishType) { this.Type = dishType; }
/ Updates the type of dish.
@param width: the updated dish type
*/
public void SetPrice(string dishPrice) { this.Price = dishPrice; }
public override string ToString() { return string.Format(dishName + "(" + dishPrice + ")", GetName(), GetPrice()); }
}
