这是面向对象的编程C#(C sharp) [英] This is object oriented programing C# (C sharp)

查看:95
本文介绍了这是面向对象的编程C#(C sharp)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在解决方案'预算'中创建一个Windows应用程序项目'CurrentBudget'。

将类库项目'BudgetLib'添加到同一解决方案'预算'



在BudgetLib项目中



1.使用以下get属性定义IExpense接口:Amount,DateExpenseMade和Description。

2.使用私有字段定义一个继承自IExpense的类Expense:_amount,_dateExpenseMade和简短描述。添加构造函数和必要的属性以及方法。

3.定义一个抽象class private with private fields:_balance,_budgetCode,_dateItExpires和费用列表(例如:List< iexpense> _expenses)。

4.添加构造函数(不应包含_expenses的参数) ,属性和方法:虚拟AddExpense方法,它应该采用单个参数:amount。此方法应该在_expenses列表中添加费用并减少预算余额,mak确保预算中有足够的资金。

添加抽象方法GeBudgetData()。

在子类中,此方法返回一个包含与子类有关的所有数据的字符串。



5.定义一个继承Budget(多态继承)的BusinessBudget类。 BusinessBudget类应该定义一个额外的私有字段:_department



6.定义一个从Budget继承(多态继承)的类HomeBudget,这个类应该定义一个额外的字段_category (例如:食品,服装,清洁,娱乐等......)



Form1:

7.定义预算清单< br $>


8.使用budgetCode作为键定义预算字典

9.在Form1_Load中创建至少3个BussinessBudget对象,至少3 HomeBudget对象。将所有内容添加到预算字典和预算列表中

10.按余额对列表进行排序

11.在Form1 [Design]中,添加一个按钮和一个显示控件(richtextbox)

12.将代码附加到按钮以显示预算列表中的所有预算。

13.添加gui以从用户请求预算代码,然后使用字典获取具有给定代码的预算对象并显示它。

14.从用户请求整数(0到255)最好使用字节类型。显示其二进制等效值。

15.写一个语句将第四位(bit3)设置为1,显示它



16。写一个语句将第六位(bit5)设置为0,显示它



17.写一个if语句来检查bit4是否设置为1









我的尝试:



是的我做了但是要验证我的编码。

Create a windows application project 'CurrentBudget' in a solution 'Budgeting'.
Add a class library project 'BudgetLib' to the same solution 'Budgeting"

In the BudgetLib project

1. Define an interface IExpense with the following get properties: Amount, DateExpenseMade, and Description.
2. Define a class Expense that, inherits from IExpense, with private fields: _amount, _dateExpenseMade, and short description. Add constructors and necessary properties, and method.
3. Define an abstract class Budget with private fields: _balance, _budgetCode, _dateItExpires, and a list of expenses (such as: List<iexpense> _expenses).
4. Add constructor (it should not include a parameter for _expenses), properties and methods: virtual AddExpense method, which should take a single parameter: amount. This method should add an expense to the _expenses list and decrease the budget balance, making sure there are enough funds in the budget.
Add an abstract method GeBudgetData().
Within child class, This method is to return a string containing all the data pertaining to the child class.

5. Define a class BusinessBudget that inherits (polymorphic inheritance) from Budget. the BusinessBudget class should define an extra private field: _department

6. Define a class HomeBudget that inherits (polymorphic inheritance)from Budget, this class should define an extra field _category (such as: Food, Clothing, Cleaning, Entertainment, etc…)

In Form1:
7. Define a List of budgets

8. Define a Dictionary of budgets, using the budgetCode as the key
9. In Form1_Load create at least 3 BussinessBudget objects and at least 3 HomeBudget objects. Add all to the budget dictionary and to the list of budget
10. Sort the list by balance
11. In Form1[Design], add a button and a display control (richtextbox)
12. Attach code to the button to display all the budgets in the budget list.
13. Add gui to request budgetcode from user, then use the dictionary to get the budget object with the given code and display it.
14. Request an integer from user (0 to 255) best to use the byte type. Display its binary equivalent value.
15. Write a statement to set the fourth bit (bit3) to 1, display it

16. Write a statement to set the sixth bit (bit5) to 0, display it

17. Write an if statement to check if bit4 is set to 1




What I have tried:

yes I did but to verify my coding.

推荐答案

引用:

这是面向对象的编程C#(C sharp)

This is object oriented programing C# (C sharp)



是的,就是这样!


Yes, that's it !

引用:

是的我做了但是要验证我的编码。

yes I did but to verify my coding.



你有问题吗?



所以,你没有尝试自己解决问题,你毫无疑问,你只是想让我们做你的HomeWork。

HomeWork问题得到简化你会遇到的那种问题的版本要在现实生活中解决,他们的目的是学习和练习

我们不做你的HomeWork。

HomeWork不会测试你乞求别人做你的工作的技能,它会让你思考和帮助您的老师会检查您对所学课程的理解以及您应用这些课程时遇到的问题。

你的任何失败都会帮助你的老师发现你的弱点并设定补救措施。

你的任何失败都会帮助你了解什么有效,什么无效,被称为'试错'学习。

所以,试一试,重读课程并开始工作。如果您遇到特定问题,请显示您的代码并解释这个问题,我们可能会提供帮助。


And you have a question ?

So, you show no attempt to solve the problem yourself, you have no question, you just want us to do your HomeWork.
HomeWork problems are simplified versions of the kind of problems you will have to solve in real life, their purpose is learning and practicing.
We do not do your HomeWork.
HomeWork is not set to test your skills at begging other people to do your work, it is set to make you think and to help your teacher to check your understanding of the courses you have taken and also the problems you have at applying them.
Any failure of you will help your teacher spot your weaknesses and set remedial actions.
Any failure of you will help you to learn what works and what don't, it is called 'trial and error' learning.
So, give it a try, reread your lessons and start working. If you are stuck on a specific problem, show your code and explain this exact problem, we might help.


昨天发布此问题时: C#面向对象的编程 [ ^ ]你被告知:我们不做你的功课。

24年没有改变小时...也不会。



脱下你的屁股,挣扎,试一试:在你需要提交这个之前,你已经没时间了你花费了更多的时间和精力去做一个徒劳无功的尝试,让别人为你做这件事,而不是你自己实际做的事情......
When you posted this question yesterday: C# object oriented programing[^] you were told: we don;t do your homework for you.
That has not changed in 24 hours ... nor will it.

Get off your ass, knuckle down, and give it a try: you are running out of time before you need to submit this, and you are spending more time and effort in a fruitless and futile attempt to get others to do it for you than you would have expended actually doing it yourself...


这篇关于这是面向对象的编程C#(C sharp)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆