Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb14d958

Browse files
author
roesnera
committed
Creates file structure, BankAccount and Main classes, adds instructions in comments
0 parents  commitb14d958

File tree

7 files changed

+587
-0
lines changed

7 files changed

+587
-0
lines changed

‎.idea/.gitignore

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎.idea/dbnavigator.xml

Lines changed: 462 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎.idea/misc.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎JavaIntro2Debrief.iml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<moduletype="JAVA_MODULE"version="4">
3+
<componentname="NewModuleRootManager"inherit-compiler-output="true">
4+
<exclude-output />
5+
<contenturl="file://$MODULE_DIR$">
6+
<sourceFolderurl="file://$MODULE_DIR$/src"isTestSource="false" />
7+
</content>
8+
<orderEntrytype="inheritedJdk" />
9+
<orderEntrytype="sourceFolder"forTests="false" />
10+
</component>
11+
</module>
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
packagecom.example.bankaccount;
2+
3+
publicclassBankAccount {
4+
/*
5+
RULES:
6+
1. No direct souts in our methods, only returns
7+
2. Do not allow for negative balances!
8+
9+
Requirements:
10+
Instance fields(data type):
11+
balance(double)
12+
nameOnAccount(String)
13+
accountNumber(int)
14+
accountType(String)
15+
16+
Class methods(return types):
17+
withdraw(boolean)
18+
deposit(boolean)
19+
constructor
20+
getters(field type)
21+
toString(String)
22+
*/
23+
24+
/*
25+
Instance field declarations should go here
26+
balance(double), nameOnAccount(String), accountNumber(int), accountType(String)
27+
These fields should not be able to be manipulated or access outside this class!
28+
*/
29+
30+
31+
/*
32+
Constructor method should go here
33+
remember to take proper input for each instance field
34+
then, assign that input to the appropriate field
35+
*/
36+
37+
38+
/*
39+
All your getter methods can go below
40+
The return type for your getter methods depends on which instance field you are getting!
41+
*/
42+
43+
44+
/*
45+
Here you should write your withdraw method
46+
requirements:
47+
1. no negatives as input
48+
2. depending on accountType:
49+
calculate transaction fee of $1.50 (checking only)
50+
calculate interest of 1% on withdrawn amount (savings only)
51+
3. check balance
52+
4. return true if successful
53+
otherwise, return false
54+
*/
55+
56+
57+
/*
58+
Here you should write your deposit method
59+
requirements:
60+
1. no negatives as input
61+
2. do not allow for overdrafting
62+
3. return true if successful
63+
otherwise, return false
64+
*/
65+
66+
67+
/*
68+
Here you should write you toString method
69+
requirements:
70+
1. returns a String that represents all your instance field values
71+
*/
72+
73+
74+
75+
}

‎src/com/example/main/Main.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
packagecom.example.main;
2+
3+
// import statement for our BankAccount class
4+
importcom.example.bankaccount.BankAccount;
5+
6+
publicclassMain {
7+
/*
8+
Your main method here should create two instances of BankAccount
9+
one as a savings type
10+
one as a checkings type
11+
12+
Call each method of each object instance to verify that they work as intended
13+
14+
If you have extra time, check for invalid input as well (negative numbers, overdrafts, etc.)
15+
we do this to ensure that our class handles input as expected
16+
this means that it also has to handle invalid input appropriately
17+
*/
18+
publicstaticvoidmain(String[]args) {
19+
20+
21+
}
22+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp