目录
一、前言
历经52天的成长,慢慢的解锁了CSDN各个模块的学习技能。上一篇分享了我在Blink动态里的成长和学习感悟。那么,今天我再来分享一下我在CSDN问答里成长心得吧。比起那些大神级别的,可能文章的内容可读性不是很高,但是我想分享给很多像我一样小白级别的博友看,对于大神来说,他们已经有自己的一套成熟的解读方案,形成了他们自身特色的名片了。但是万事开头难,所以我分享的系列对于初识CSDN的博友来说,还是一个不错的借鉴之路的。
二、记录问答里的每个第一次
1、第一次回答
我的第一次回答,是在我码龄四天的时候进行的,是一个里程碑的纪念时刻。那个时候正好自身也在学习HTML和CSS,然后看到了这位博友的这个问题,虽然不能正面的给出技术上的支持和指导,但是回答的内容也算是对其心态和意志上的一种鼓励吧!
2、第一次用代码帮助博友解决问题(也是第一次得到问答赏金)
那个时候用代码回答问题,还不会使用代码器,就直接复制在评论里。这也算是一种青涩的回忆吧。然后这位博友私信找我问了我另一个问题,帮忙回答问题的同时,巩固了自身所学,还交了朋友,顺便求了个关注,哈哈!聊天内容截图如下:
晚上10:23拿到的原题,10:39写完发给博友的,花了十几分钟,好像效率还行哈,这种题型的解答规则都大同小异,两个for循环,外循环控制行数,内循环控制列数,找出其中的规律和关系,按照这层规律和关系打印输出即可。
3、第一次发现“精华”
虽然不知道“这个精华”的评价标准,但是盖的章,看着着实赏心悦目!
4、第一次使用代码块插入代码
使用代码块插入代码,确实便利了不少,于人于己都能很清楚的表达回答的逻辑性,也便于博友复制粘贴去测试代码的运行结果。看到没,精华+1。
5、第一次代码超过100行的回答
使用循环知识,写得一个超过100行代码的程序,这一次的回答,让我在助人同时,更加理解了为乐的道理。学习就是一种相互的过程,你在帮助别人的解决问题的同时,别人的问题也同样成就了我们。又是一条精华的回答,赚的一顿盖浇饭的午餐费。
6、第一次能力范围内比较综合的问答
这是我的回答的第一版本,后来自己没事干的时候,根据现实中真实的逻辑,改良这个版本,具体代码和效果如下:
属性方法类——BankAccount类:
package cn.bdqn.demo02;
import java.util.Scanner;
public class BankAccount {
// 定义账户、余额属性
private String cardId;
private int balance;
// 添加无参构造
public BankAccount() {
}
// 添加有参构造
public BankAccount(String cardId, int balance) {
this.cardId = cardId;
this.balance = balance;
}
// 添加get/set方法
public String getCardId() {
return cardId;
}
public void setCardId(String cardId) {
this.cardId = cardId;
}
public int getBalance() {
return balance;
}
public void setBalance(int balance) {
this.balance = balance;
}
// 存款:将一定金额存入账户
public void deposit(int money) {
int balance = this.balance;
this.balance = balance + money;
System.out.println("存款成功," + this.getCardId() + "余额为" + this.balance+ "元");
}
// 取款:实现从账户中提取一定金额的功能
public void withdraw(int money) {
int balance = this.balance;
if (balance >= money) {
this.balance = balance - money;
System.out.println("取款成功," + this.getCardId() + "余额为"+ this.balance + "元");
} else if (balance < money) {
System.out.println("取款失败,您的余额不足");
}
}
// 转账:实现将金额从一个帐户转移到另一个帐户的功能
public void transfer(BankAccount bankAccount,int money) {
if (bankAccount.getBalance()-money > 0) {
this.balance = money + this.balance;
bankAccount.setBalance(bankAccount.getBalance()-money);
System.out.println("转账成功," + this.getCardId() + "余额为"+ this.balance + "元");
System.out.println("转账成功," + bankAccount.getCardId() + "余额为"+ bankAccount.getBalance() + "元");
} else {
System.out.println("转账失败,您的余额不足");
}
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// 初始化两张银行卡卡号和余额
BankAccount account1 = new BankAccount("6227****3301", 1000);
BankAccount account2 = new BankAccount("6227****2533", 2000);
System.out.println("请输入序号选择需要操作哪张银行卡:1、" + account1.getCardId()+ "\t\t2、" + account2.getCardId());
//当前银行卡
BankAccount account = new BankAccount();
//其它银行卡
BankAccount otherAccount = new BankAccount();
switch (sc.nextInt()) {
case 1:
account = account1;
otherAccount=account2;
break;
case 2:
account = account2;
otherAccount=account1;
break;
}
System.out.println("请输入序号选择存钱/取钱业务:1、存钱\t\t2、取钱");
switch (sc.nextInt()) {
case 1:
// 存钱
System.out.println("请输入向" + account.getCardId() + "银行卡存入多少钱:");
int money1 = sc.nextInt();
account.deposit(money1);
break;
case 2:
// 取钱
System.out.println("请输入从" + account.getCardId() + "银行卡取出多少钱:");
int money2 = sc.nextInt();
account.withdraw(money2);
break;
}
// 将account银行卡的钱转账到otherAccount银行卡中
System.out.println("请输入需要从当前银行卡转到其它银行卡的金额:");
int money=sc.nextInt();
otherAccount.transfer(account,money);
}
}
测试类——BankTest类
package cn.bdqn.demo02;
import java.util.Scanner;
public class BankTest {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// 初始化两张银行卡卡号和余额
BankAccount account1 = new BankAccount("6227****3301", 1000);
BankAccount account2 = new BankAccount("6227****2533", 2000);
System.out.println("请输入序号选择需要操作哪张银行卡:1、" + account1.getCardId()+ "\t\t2、" + account2.getCardId());
//当前银行卡
BankAccount account = new BankAccount();
//其它银行卡
BankAccount otherAccount = new BankAccount();
switch (sc.nextInt()) {
case 1:
account = account1;
otherAccount=account2;
break;
case 2:
account = account2;
otherAccount=account1;
break;
}
System.out.println("请输入序号选择存钱/取钱业务:1、存钱\t\t2、取钱");
switch (sc.nextInt()) {
case 1:
// 存钱
System.out.println("请输入向" + account.getCardId() + "银行卡存入多少钱:");
int money1 = sc.nextInt();
account.deposit(money1);
break;
case 2:
// 取钱
System.out.println("请输入从" + account.getCardId() + "银行卡取出多少钱:");
int money2 = sc.nextInt();
account.withdraw(money2);
break;
}
// 将account银行卡的钱转账到otherAccount银行卡中
System.out.println("请输入需要从当前银行卡转到其它银行卡的金额:");
int money=sc.nextInt();
otherAccount.transfer(account,money);
}
}
效果展示:
上面总结了很多第一次,每一个第一次对于我来说,都是一个很有纪念意义的时刻。其实每一次的回答,对我来说,都是一种学习和进步,包括我可能花了一个小时写得代码方案,即使只有我一个人回答了问题,也没得到采纳,但是没关系呀,我学习了就是我成长啦。
三、回答战绩
到昨天为止,回答的问题已经有了102道题目了。 21个回答被采纳,问答收益:35.30元,问答打赏收益:1.60元。收益的多少不是我们学习的主要目的,当学习成了你自身的内驱力,是你主观能动的表达之后,你的成长将会是质的飞跃。
码文不易,本篇文章就介绍到这里,如果想要学习更多乐趣知识,请关注博主,博主带你学习IT技术知识的同时,也助你提高心性的养成之道。欢迎阅读我的第四栏目:《国学周更—心性养成之路》。