小芳便利店 java 源代码

上传者: pwy1198156945 | 上传时间: 2022-11-15 08:18:48 | 文件大小: 9KB | 文件类型: RAR
小芳便利店 源代码 java写的 ackage account; import junit.framework.TestCase; public class AccountTest extends TestCase { private Account AccountA; private Account AccountB; public AccountTest(String name) { super(name); } public void setUp(){ AccountA=new Account("notyy",100); AccountB=new Account("bricks",200); } public static void main(String args[]) { junit.textui.TestRunner.run(AccountTest.class); } public void testAccount(){ AccountA=new Account("notyy",100); AccountB=new Account("bricks",200); //assertEquals("notyy",AccountA.Owner); //assertEquals(100,AccountA.Balance,2); //assertEquals("bricks",AccountB.Owner); //assertEquals(200,AccountB.Balance,2); assertEquals("notyy",AccountA.getOwner()); } public void testCredit(){ AccountA=new Account("notyy",100); AccountB=new Account("bricks",200); AccountA.credit(100); //100+100=200 assertEquals(200,AccountA.getBalance(),2); AccountB.credit(150); //200+150=350 assertEquals(350,AccountB.getBalance(),2); } public void testDiscount(){ AccountA=new Account("notyy",100); AccountB=new Account("bricks",200); AccountA.discount(50); //100-50=50 assertEquals(50.00,AccountA.getBalance(),2); AccountB.discount(120); //200-120=80 assertEquals(80,AccountB.getBalance(),2); } public void testTransfer(){ AccountA.transfer(AccountB,80.00); //100-80=20 //200+80=280 assertEquals(20.00,AccountA.getBalance(),2); assertEquals(280.00,AccountB.getBalance(),2); } }

文件下载

资源详情

[{"title":"( 17 个子文件 9KB ) 小芳便利店 java 源代码","children":[{"title":"Junit实验程序","children":[{"title":"forJunit3.8_swing","children":[{"title":"SampleCalculator.java <span style='color:#111;'> 245B </span>","children":null,"spread":false},{"title":"MyStack.java <span style='color:#111;'> 615B </span>","children":null,"spread":false},{"title":"TestSample.java <span style='color:#111;'> 713B </span>","children":null,"spread":false},{"title":"AccountTest.java <span style='color:#111;'> 1.60KB </span>","children":null,"spread":false},{"title":"Account.java <span style='color:#111;'> 569B </span>","children":null,"spread":false},{"title":"Account.java.bak <span style='color:#111;'> 569B </span>","children":null,"spread":false},{"title":"StackTest.java <span style='color:#111;'> 499B </span>","children":null,"spread":false},{"title":"junit","children":[{"title":"samples","children":[{"title":"account","children":[{"title":"Account.class <span style='color:#111;'> 734B </span>","children":null,"spread":false},{"title":"AccountTest.class <span style='color:#111;'> 1.25KB </span>","children":null,"spread":false}],"spread":true},{"title":"calculator","children":[{"title":"SampleCalculator.class <span style='color:#111;'> 342B </span>","children":null,"spread":false},{"title":"TestSample.class <span style='color:#111;'> 534B </span>","children":null,"spread":false}],"spread":true},{"title":"TestMyAllSample.class <span style='color:#111;'> 558B </span>","children":null,"spread":false}],"spread":true}],"spread":true},{"title":"TestMyAllSample.java <span style='color:#111;'> 427B </span>","children":null,"spread":false}],"spread":true},{"title":"forJunit4.1_text","children":[{"title":"account","children":[{"title":"Account.class <span style='color:#111;'> 706B </span>","children":null,"spread":false},{"title":"AccountTest.class <span style='color:#111;'> 1.48KB </span>","children":null,"spread":false}],"spread":true},{"title":"AccountTest.java <span style='color:#111;'> 1.48KB </span>","children":null,"spread":false},{"title":"Account.java <span style='color:#111;'> 534B </span>","children":null,"spread":false}],"spread":true}],"spread":true}],"spread":true}]

评论信息

免责申明

【只为小站】的资源来自网友分享,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,【只为小站】 无法对用户传输的作品、信息、内容的权属或合法性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论 【只为小站】 经营者是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。
本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二条之规定,若资源存在侵权或相关问题请联系本站客服人员,zhiweidada#qq.com,请把#换成@,本站将给予最大的支持与配合,做到及时反馈和处理。关于更多版权及免责申明参见 版权及免责申明