c# - 此方法未实现 c#
问题描述
我是 c# 的新手,我正在为预算应用程序写作。我有我的主课,我的抽象课是我的主课:
static void Main(string[] args)
{
Calculate cal1 = new Calculate();
cal1.getAmounts();
}
这是我的费用类别:
abstract class Expense
{
public abstract double getAmounts();
public double grossIncome;
public double estTax;
public double rent;
public double deposit;
public float intRate;
public double price;
public int repayMonth;
public [] monthExps = { "Groceries", "Water and Lights", "Travel costs", "Cell phone and telephone", "Other expenses" };
}
class Calculate : Expense
{
public override double getAmounts()
{
Console.WriteLine("Enter Gross Income");
string gI = Console.ReadLine();
grossIncome = Convert.ToInt32(gI);
Console.WriteLine("Groceries:" + "R" + grossIncome);
Console.WriteLine("Enter Estimated Tax");
string eT = Console.ReadLine();
estTax = Convert.ToInt32(eT);
Console.WriteLine("Estimated Tax:" + "R" + estTax);
Console.WriteLine("Enter Groceries amount");
string g = Console.ReadLine();
monthExps[0] = Convert.ToInt32(g);
Console.WriteLine(":" + "R" + monthExps[0]);
}
}
我的第一个问题是我试图让用户输入一个数组来存储双精度值。其次,我的公共覆盖双 getAmounts在 getAmounts 下方有一条红线。我的目标是输入值并输出这些值,但是当我运行代码时,我得到 System.NotImplementedException:“方法或操作未实现。” 在这条线上:
Console.WriteLine("Enter Groceries amount");
谁能帮我解决这个错误
解决方案
推荐阅读
- apache-nifi - 某些文件的 NiFi FetchFTP 删除过程失败
- javascript - Python 抓取所有 javascript mailto
- css - 矩形上的平滑 CSS 变换缩放,保持均匀的边框
- python - tkinter - 更改禁用条目小部件的颜色
- python - 如何在 Keras2.2.4 中使用initializations.normal
- python - TypeError: unhashable type: 'numpy.ndarray' 尝试绘制 DataFrame 时
- python - 如何在 python 中拆分存储有 json 数据的单元格?
- ios - 如何在 iOS 13 中更改分段控制器的角半径属性?
- ios - self.view 有限制吗?
- sql - 将前列与表连接相同的多个 SQL 行连接起来