-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CS2113-T11-3] CliRental #29
Open
tkhahns
wants to merge
724
commits into
nus-cs2113-AY2425S1:master
Choose a base branch
from
AY2425S1-CS2113-T11-3:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 164 commits
Commits
Show all changes
724 commits
Select commit
Hold shift + click to select a range
6e027ac
Fix issue #138
rexkoh425 4fdba7b
Fix issue #142
rexkoh425 0e4e3dc
Update Test finding transactions by customer
tkhahns ddba790
Fix issue #153
rexkoh425 03b295b
Fix test case
tkhahns 5b9ebe9
Modify test case logic
tkhahns 8018042
Add manual testing instructions
rexkoh425 2d36608
Update files
7c2f668
Update files
ae00d3c
solve tx id not generated when addtxwithoutPrintingInfo is called
418a749
Update TransactionListTest.java
tkhahns c57aa48
Update TransactionListTest.java
tkhahns 9b1ab98
Add age restriction for customer
rexkoh425 4679083
Update Junit
rexkoh425 53a9ef1
added generation of transaction id to test cases
02a96c7
extracted if conditions for checks on car has been rented during and …
074f1c5
Update Junit
rexkoh425 04ae345
Add new exception to handle cases when car rental price exceeds the t…
CT9ARyan 3e5338d
Define new constant to store maximum car rental price
CT9ARyan 17b777e
Update 'isValidPrice' method and edit 'isValidPrice' code block in 'p…
CT9ARyan 3732e8c
Update Quick Start
rexkoh425 5124b77
Update imports
rexkoh425 8eb78fd
Merge pull request #207 from SemiColonKen/master
SemiColonKen ee5a511
Merge branch 'master' into A-SaveFileDocumentation
rexkoh425 d648175
Fix checkstyle
rexkoh425 bc0bd24
Merge branch 'A-SaveFileDocumentation' of https://github.com/rexkoh42…
rexkoh425 210fbb4
Fix checkstyle
rexkoh425 0aa9b11
Update Ui test
rexkoh425 9590199
Update Ui test
rexkoh425 1ffba0b
Update Ui test
rexkoh425 b0d6f14
Change to Customer name
rexkoh425 d327fd8
Merge pull request #211 from rexkoh425/A-SaveFileDocumentation
rexkoh425 4e29bd9
fix authorship
AaronZZ10 159bd2b
fix authorship
AaronZZ10 f979cb0
Merge branch 'master' into master
tkhahns 9b5751b
updated ppp
AaronZZ10 ff9a250
Merge pull request #212 from AaronZZ10/master
AaronZZ10 877a8a6
update clearTransactionList mehod
tkhahns 948793a
Update to store transactionID
rexkoh425 b7f2184
Fix testLoadTransactionDataIfExist()
tkhahns 875d771
Fix testUpdateTransactionDataFile()
tkhahns 32c9207
Remove unused imports
rexkoh425 6c443a9
Fix testGetTransactionDataFilename()
tkhahns 1a9c05f
Merge pull request #213 from rexkoh425/A-StoreTxID
tkhahns dcf89ba
Merge branch 'master' into master
tkhahns f1ec8d9
Fix Transactions code
tkhahns d88e1f1
Change implementation of Tx ID generation for easier saving and loadi…
3bb7f4d
Add Transactionfile to load Tx Counter
eda2cb3
Merge pull request #208 from tkhahns/master
tkhahns 6af181e
Add error handling for data
rexkoh425 03b7f58
Fix checkstyle
rexkoh425 e5a5f06
Update UG
rexkoh425 d498adb
Fixed saved tx id
6efe9fc
Merge branch 'master' into master
SemiColonKen 297e70b
Fixed junit test error
8b69738
Fixed junit test error (forgot to add transaction files)
c23a2b4
Fixed merge error (TransactionList)
1b20e5f
Fixed junit test error (TransactionTest)
88ceb86
Fixed junit test error (TransactionListTest)
b88bd4a
Fixed junit test error (TransactionTest)
b3ee247
Merge pull request #215 from SemiColonKen/master
tkhahns 34b808d
Change phone number format
tkhahns 35e1800
Merge branch 'master' of https://github.com/tkhahns/tp
tkhahns 78844f5
A-RemoveAllCustomers
tkhahns 1885723
Remove clearTransactionCounter method in test file
tkhahns 4c06ff0
Add phone number constraints
tkhahns bd86431
Add test cases for valid phone numbers
tkhahns 5000091
Fix parser test
tkhahns 3d6fc26
Comment out the clear method before tests
tkhahns 19e61c1
Remove clear methods
tkhahns 9b253f0
Update EXPECTED output
tkhahns a74f49b
Modify runtest.sh
tkhahns a8e27a0
Fix runtest.bat and find-txs-by-customer
tkhahns d1beac8
Update documentation and sample code output for some features in user…
CT9ARyan 3dc63c1
Fixed bug: find-tx-by-customer to display exact input from customer a…
ba883ae
Restore background color of all diagrams to white to standardise acro…
CT9ARyan ca279e2
Modify EXPECTED output
tkhahns e1fe8c6
Update 'CarList' methods to ignore letter case when querying for lice…
CT9ARyan f7d9cd5
Add new method to check if string can be parsed to double in 'CarParser'
CT9ARyan b7ec6a0
Fixed junit test error (TransactionListTest)
fc6f31c
Add new if block that throws NumberFormatException with a custom mess…
CT9ARyan 9725857
Merge branch 'AY2425S1-CS2113-T11-3:master' into master
SemiColonKen 1a3a3ce
Merge pull request #216 from tkhahns/master
tkhahns 47b3c9a
Edit 'remove-car' methods and related exception messages when an exce…
CT9ARyan b71a048
Edit commands description in help page to match those in user guide
CT9ARyan 61434f9
Add try-catch block for the add-car command case to catch any NumberF…
CT9ARyan 353c586
Update command format of add-tx
CT9ARyan 3e0fa79
Update 'removeAllTxs' method to update all car rental status to 'Avai…
CT9ARyan 2aed70a
Fixed bug; Duration not shown when add-tx with 1 day
51a8dce
Merge branch 'master' into branch-BugFixes
CT9ARyan 76a4386
Merge pull request #217 from SemiColonKen/master
tkhahns 3dd8fc5
Add summary of contents with section links in user guide
CT9ARyan 8586875
Update JUnit tests and test conditions
CT9ARyan e2b2d2f
Update EXPECTED.txt
CT9ARyan 2702855
Add input.txt back to text-ui-test folder due to accidental deletion
CT9ARyan 5f1cef2
Edit input.txt contents
CT9ARyan 67d007e
Update EXPECTED.txt
CT9ARyan bcdc8c2
Merge pull request #218 from CT9ARyan/branch-BugFixes
SemiColonKen de0eb95
Update unique Customer constraints
tkhahns d01be43
Merge branch 'AY2425S1-CS2113-T11-3:master' into master
tkhahns dda4809
Update 'add-car' description to be clearer and more specific in user …
CT9ARyan 1892031
Update portfolio link to PPP in AboutUs.md
CT9ARyan e45fb52
Add new .md file for PPP
CT9ARyan b6733fe
Add 'Overview' section documenting product summary in PPP
CT9ARyan 059fac9
Add 'Code contribution' and 'Features implemented' sections in PPP
CT9ARyan f4a518a
Add 'User guide contributions' in PPP
CT9ARyan a06553f
Add 'Developer guide contributions' section in PPP
CT9ARyan 57aeb6b
Fix checkstyle error
tkhahns 09c5921
Merge branch 'master' of https://github.com/tkhahns/tp
tkhahns 8e293e9
Fix checkstyle error
tkhahns 63b2da1
Merge pull request #219 from tkhahns/master
tkhahns 392a90e
Add product name at the top of PPP
CT9ARyan bfbf4f6
Add pull request links for PRs reviewed under 'Team-based tasks contr…
CT9ARyan e02ebb9
Improve format and aesthetics of PPP and edited description of some f…
CT9ARyan 64f47d5
Reset TX ID counter to 1 when removing all TXs
b7f340e
Merge branch 'master' into A-RexCodeQuality
rexkoh425 3687dd0
Resolve merge conflict
rexkoh425 63c7932
Add test cases
tkhahns 97b7f9b
Hide footnote
rexkoh425 cac0bc8
Edit Junit
rexkoh425 9d4ce54
Merge pull request #222 from tkhahns/master
tkhahns d756de1
Merge pull request #220 from SemiColonKen/master
tkhahns 3bdaf07
Resolve merge conflict
rexkoh425 8d4427b
Resolve merge conflict
rexkoh425 a88d5d8
Convert newly updated UML diagrams to .png file to be used in develop…
CT9ARyan d96786e
Updated UG for missing commands. Added updated sample output.
7468fee
Update contact number info
rexkoh425 86242dc
Merge pull request #223 from SemiColonKen/master
tkhahns 6948ccb
Updated UG
1ceb4ea
Fix spacing
rexkoh425 7d9afae
Merge branch 'master' into A-RexCodeQuality
rexkoh425 bab215e
Merge pull request #221 from rexkoh425/A-RexCodeQuality
rexkoh425 8a7397c
Merge pull request #224 from SemiColonKen/master
tkhahns d438e76
Create PPP
tkhahns 4247b42
Update list of commands in help page
CT9ARyan 9cea98b
Add new UML sequence diagram for 'remove-car' command
CT9ARyan 947bdd3
Remove box grouping in remove car sequence diagram
CT9ARyan 86c1c4b
Convert remove car sequence diagram into .png for developer guide
CT9ARyan 60d574b
Update diagrams
rexkoh425 3939bdb
Update code output .png files due to change in code output format for DG
CT9ARyan ebb53b0
Add new section for 'removing a car' sequence diagram
CT9ARyan 9999638
Remove unnecessary lines in DG
CT9ARyan 6e28a84
add-tx customer name is case insensitive now. John and john means the…
2e64e4f
Merge branch 'master' into master
SemiColonKen 901699d
Merge branch 'master' into branch-PPP
CT9ARyan 458ac7f
Update DG
rexkoh425 0355493
Edit checkstyle
rexkoh425 0beb200
Update EXPECTED.txt to pass CLI test on github
CT9ARyan f476d5d
Merge pull request #226 from SemiColonKen/master
SemiColonKen 1637829
Merge pull request #225 from CT9ARyan/branch-PPP
CT9ARyan 1287f54
Merge branch 'AY2425S1-CS2113-T11-3:master' into master
tkhahns 35a75e1
Update PPP
rexkoh425 4ab7802
Update sequence diagram
rexkoh425 26fda81
Add profile pic
rexkoh425 92b2c58
remove-user is now case insensitive
0ba82d8
remove-user is now case insensitive
e0220da
Merge branch 'AY2425S1-CS2113-T11-3:master' into master
SemiColonKen 156a039
Slight modification of output for printUncompletedTransactions, remov…
tkhahns ec54afe
Fix userName not found test case
tkhahns 318d713
Merge pull request #228 from tkhahns/master
tkhahns 607e9c9
Improve Junit test case
rexkoh425 72f162b
Merge branch 'master' into master
SemiColonKen ef7f0c0
Merge pull request #229 from rexkoh425/A-Rex-V2-1
rexkoh425 eb7f50c
Merge pull request #227 from SemiColonKen/master
SemiColonKen c162620
Update formatting for PPP
CT9ARyan 72b481b
Update logo and fix find-txs-by-customer output
tkhahns 2dc97ed
Merge branch 'AY2425S1-CS2113-T11-3:master' into master
tkhahns 376184c
Fix checkstyle error
tkhahns 4ac89e8
Update EXPECTED.txt
tkhahns 1106888
Update logo
tkhahns ea87fdb
Complete DG with User Stories
tkhahns fb9bac9
Update AboutUs.md
tkhahns c98fc0f
Add PPP
tkhahns f5a8af0
Update PPP
tkhahns 9fc3618
updated ug
a161451
updated customer list
39a9eb3
Merge branch 'master' of https://github.com/SemiColonKen/tp
e678a55
Added PPP
e6ef22f
Updated remove-customer
666425f
add junittest for remove-user
b203ed3
updated remove-user for empty list
60fcf5b
updated ppp
AaronZZ10 fef38ef
improve code quality
AaronZZ10 0df0ead
updated import for CustomerListTest to fix checkstyle error
fdd8101
updated line length for CustomerList to fix checkstyle error
c7665ad
improve code quality
AaronZZ10 017b842
improve code quality
AaronZZ10 9c3b69f
Merge pull request #232 from AaronZZ10/master
AaronZZ10 d20ed88
Update PPP
tkhahns f0676fb
Merge pull request #230 from tkhahns/master
tkhahns 72f5de6
Merge pull request #231 from SemiColonKen/master
tkhahns 489245b
Update documentation
rexkoh425 f033bd2
Merge pull request #234 from rexkoh425/A-RexFinalPR
tkhahns 73689d6
update iotest
AaronZZ10 40ddfa3
Merge branch 'AY2425S1-CS2113-T11-3:master' into master
AaronZZ10 32c5924
update iotest
AaronZZ10 3d780ac
update iotest
AaronZZ10 f33900c
update iotest
AaronZZ10 52f68e1
Update Junit
rexkoh425 35e9d41
update iotest
AaronZZ10 e9d0647
Merge pull request #236 from rexkoh425/A-JunitFix
rexkoh425 79fcf5c
update iotest
AaronZZ10 0eac869
update iotest
AaronZZ10 8816c11
update iotest
AaronZZ10 0262b4c
Update Junit
rexkoh425 d5998b4
update iotest
AaronZZ10 5ef257f
update iotest
AaronZZ10 187bf07
Update Junit
rexkoh425 f612ee6
update iotest
AaronZZ10 8e7a981
Update DG for manual test
rexkoh425 e5066e4
update iotest
AaronZZ10 7aaf6db
update iotest
AaronZZ10 b17fbe5
Merge pull request #237 from rexkoh425/A-JunitFix
tkhahns 5511330
Merge branch 'AY2425S1-CS2113-T11-3:master' into master
AaronZZ10 74ee923
Update age limit handling
rexkoh425 5d7e101
Merge pull request #235 from AaronZZ10/master
AaronZZ10 28f3dbe
Merge pull request #238 from rexkoh425/A-JunitFix
tkhahns 21b74b2
fix merge conflict
AaronZZ10 4404b9d
Update PPP
rexkoh425 14880ba
Merge pull request #239 from rexkoh425/A-JunitFix
rexkoh425 3cb766a
Add <br>
rexkoh425 139cf58
Merge pull request #240 from rexkoh425/A-JunitFix
rexkoh425 c269619
Update formatting
rexkoh425 c8e6399
Merge branch 'AY2425S1-CS2113-T11-3:master' into master
AaronZZ10 de8a954
images of ryan and aaron
AaronZZ10 1ced23d
Merge pull request #242 from rexkoh425/A-JunitFix
rexkoh425 666e7f9
Merge pull request #241 from AaronZZ10/master
AaronZZ10 3857ff9
Updated ug and ppp
716993b
Slight modification of UG, DG, and upload team members' photos
tkhahns 85a1b47
Merge pull request #243 from SemiColonKen/master
tkhahns 4c60fbe
Merge branch 'master' into master
tkhahns a7baa3e
Merge pull request #244 from tkhahns/master
tkhahns 06f4873
update ppp and dg
AaronZZ10 4c15de9
Merge pull request #245 from AaronZZ10/master
AaronZZ10 bc3e534
update ppp and dg
AaronZZ10 bd3168b
update ppp
AaronZZ10 a3159e3
update ppp
AaronZZ10 d49acaa
update ppp
AaronZZ10 b59311c
update ppp
AaronZZ10 80b0ed9
Merge pull request #246 from AaronZZ10/master
AaronZZ10 2c2b95d
Update DG
tkhahns 893d164
Merge branch 'AY2425S1-CS2113-T11-3:master' into master
tkhahns 19d499c
update ppp
AaronZZ10 fb61f1e
Merge pull request #247 from tkhahns/master
tkhahns c9994d5
Merge pull request #248 from AaronZZ10/master
AaronZZ10 48f2a95
Update AboutUs.md
tkhahns 1e7e9fa
Merge branch 'master' of https://github.com/tkhahns/tp
tkhahns 221ce44
Merge pull request #249 from tkhahns/master
tkhahns 05efffc
Fix Kenneth's PPP link error
tkhahns fe4d539
Merge pull request #250 from tkhahns/master
tkhahns File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,18 @@ | ||
# About us | ||
|
||
|
||
Display | Name | Github Profile | Portfolio | ||
--------|:-----:|:------------------------------------:|:---------: | ||
![](/docs/team/Khanh.png) | Khanh | [Github](https://github.com/tkhahns) | [Portfolio](docs/team/johndoe.md) | ||
|
||
Display | Name | Github Profile | Portfolio | ||
--------|:--------:|:--------------------------------------:|:---------: | ||
![](https://via.placeholder.com/100.png?text=Photo) | Rex Koh | [Github](https://github.com/rexkoh425) | [Portfolio](docs/team/RexKoh.md) | ||
|
||
Display | Name | Github Profile | Portfolio | ||
--------|:----:|:--------------:|:---------: | ||
![](https://via.placeholder.com/100.png?text=Photo) | John Doe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Don Joe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Ron John | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | John Roe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Don Roe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Ryan Fong | [Github](https://github.com/CT9ARyan) | [Portfolio](./team/ryanfong.md) | ||
|
||
Display | Name | Github Profile | Portfolio | ||
--------|:-------:|:--------------------------------------:|:---------: | ||
![](https://avatars.githubusercontent.com/u/94769848?v=4) | Liu Hao | [Github](https://github.com/AaronZZ10) | [Portfolio](./team/liuhao.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,68 @@ | ||
# User Guide | ||
# CliRental User Guide | ||
|
||
## Introduction | ||
|
||
{Give a product intro} | ||
Clirental is a CLI-based application which allows car rental companies | ||
to track their customers , cars and rental transactions. | ||
|
||
## Quick Start | ||
|
||
{Give steps to get started quickly} | ||
|
||
1. Ensure that you have Java 17 or above installed. | ||
1. Down the latest version of `Duke` from [here](http://link.to/duke). | ||
2. Download the latest version of `CliRental` from [here](https://github.com/AY2425S1-CS2113-T11-3/tp/releases). | ||
|
||
## Features | ||
## Features | ||
|
||
{Give detailed description of each feature} | ||
### Adding a user to the database: `add-user` | ||
|
||
### Adding a todo: `todo` | ||
Adds a new item to the list of todo items. | ||
Adds a customer to the list of customers tracked by the car rental application | ||
|
||
Format: `todo n/TODO_NAME d/DEADLINE` | ||
Format: `add-user /u [USERNAME] /a [AGE] /c [CONTACT_NUMBER]` | ||
|
||
* The `DEADLINE` can be in a natural language format. | ||
* The `TODO_NAME` cannot contain punctuation. | ||
* `USERNAME` : `STRING`. | ||
* `AGE` : `INT` | ||
* `CONTACT_NUMBER` : `INT` | ||
* `/u` , `/a` , `/c` must be in sequence. | ||
|
||
Example of usage: | ||
|
||
`todo n/Write the rest of the User Guide d/next week` | ||
`add-user /u John /a 18 /c 95382572` | ||
|
||
Sample Response: | ||
|
||
``` | ||
____________________________________________________________ | ||
add-user /u John /a 18 /c 95382572 | ||
Customer added | ||
Username : John | ||
Age : 18 | ||
Contact Number : 95382572 | ||
What would you like to do? | ||
____________________________________________________________ | ||
``` | ||
|
||
### List all cars in the database: `list-cars` | ||
|
||
`todo n/Refactor the User Guide to remove passive voice d/13/04/2020` | ||
Lists all the car which the company owns. | ||
|
||
Format: `list-cars` | ||
|
||
Sample Response: | ||
|
||
``` | ||
____________________________________________________________ | ||
list-cars | ||
Here are the current cars in the company | ||
1) Toyota Corolla | SGM4932K | $120.0 | Not Rented | ||
What would you like to do? | ||
____________________________________________________________ | ||
``` | ||
|
||
## FAQ | ||
|
||
**Q**: How do I transfer my data to another computer? | ||
**Q**: Is there any file saving system in place currently? | ||
|
||
**A**: {your answer here} | ||
**A**: Unfortunately no , we are currently working on it. Thank you for your patience. | ||
|
||
## Command Summary | ||
|
||
{Give a 'cheat sheet' of commands here} | ||
|
||
* Add todo `todo n/TODO_NAME d/DEADLINE` | ||
* Add todo `add-user /u [USERNAME] /a [AGE] /c [CONTACT_NUMBER]` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# John Doe - Project Portfolio Page | ||
# Ryan Fong - Project Portfolio Page | ||
|
||
## Overview | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package car; | ||
|
||
import exceptions.CarException; | ||
|
||
public class Car { | ||
|
||
private String model; | ||
private String licensePlateNumber; | ||
private double price; | ||
private boolean isRented; | ||
|
||
public Car(String model, String licensePlateNumber, double price) throws CarException{ | ||
this.model = model; | ||
this.licensePlateNumber = licensePlateNumber; | ||
if (price < 0.00) { | ||
throw CarException.invalidPrice(); | ||
} else { | ||
this.price = Double.parseDouble(String.format("%.2f", price)); | ||
} | ||
this.isRented = false; | ||
} | ||
|
||
public void setModel(String model) { | ||
this.model = model; | ||
} | ||
|
||
public String getModel() { | ||
return model; | ||
} | ||
|
||
public void setLicensePlateNumber(String licensePlateNumber) { | ||
this.licensePlateNumber = licensePlateNumber; | ||
} | ||
|
||
public String getLicensePlateNumber() { | ||
return licensePlateNumber; | ||
} | ||
|
||
public void setPrice(double price) { | ||
this.price = price; | ||
} | ||
|
||
public double getPrice() { | ||
return price; | ||
} | ||
|
||
public void setRented(boolean isRented) { | ||
this.isRented = isRented; | ||
} | ||
|
||
public boolean isRented() { | ||
return isRented; | ||
} | ||
|
||
public String getRentedStatus(){ | ||
if(isRented){ | ||
return "Rented"; | ||
} | ||
return "Not Rented"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package car; | ||
|
||
import java.util.ArrayList; | ||
|
||
public class CarList { | ||
|
||
public static ArrayList<Car> carsList = new ArrayList<>(); | ||
|
||
public static ArrayList<Car> getCarsList() { | ||
return carsList; | ||
} | ||
|
||
public static void addCar(Car car) { | ||
carsList.add(car); | ||
System.out.println("Car added to list"); | ||
System.out.println("Car details:"); | ||
System.out.println(car.getModel() + " | " + car.getLicensePlateNumber() | ||
+ " | $" + car.getPrice() + " | " + car.getRentedStatus()); | ||
} | ||
|
||
public static void removeCar(String carLicensePlateNumber) { | ||
Car carToRemove = null; | ||
|
||
// Iterate through the list of cars to find the one with the given license plate | ||
for (Car car : carsList) { | ||
if (car.getLicensePlateNumber().equals(carLicensePlateNumber)) { | ||
carToRemove = car; | ||
break; | ||
} | ||
} | ||
|
||
// Remove the car if it exists | ||
if (carToRemove != null) { | ||
carsList.remove(carToRemove); | ||
System.out.println("Car with license plate " + carLicensePlateNumber + " removed from list."); | ||
} else { | ||
System.out.println("No car found with license plate " + carLicensePlateNumber); | ||
} | ||
} | ||
public static void printCarList(){ | ||
System.out.println("Here are the current cars in the company"); | ||
for(int i = 0 ; i < carsList.size(); i++){ | ||
Car car = carsList.get(i); | ||
System.out.println( (i + 1) + ") " + car.getModel() + " | " + car.getLicensePlateNumber() | ||
+ " | $" +car.getPrice() + " | " + car.getRentedStatus()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package customer; | ||
|
||
/** | ||
* Represents customers of CliRental | ||
*/ | ||
public class Customer { | ||
|
||
private String username; | ||
private int age; | ||
private int contactNumber; | ||
|
||
public Customer(String username, int age, int contactNumber){ | ||
this.username = username; | ||
this.age = age; | ||
this.contactNumber = contactNumber; | ||
} | ||
|
||
public String getUsername() { | ||
return username; | ||
} | ||
|
||
public int getContactNumber() { | ||
return contactNumber; | ||
} | ||
|
||
public int getAge() { | ||
return age; | ||
} | ||
|
||
public void setUsername(String username) { | ||
this.username = username; | ||
} | ||
|
||
public void setAge(int age) { | ||
this.age = age; | ||
} | ||
|
||
public void setContactNumber(int contactNumber) { | ||
this.contactNumber = contactNumber; | ||
} | ||
|
||
public String toString(){ | ||
return "Username : " + this.getUsername() + "\n" | ||
+ "Age : " + this.getAge() + "\n" | ||
+ "Contact Number : " + this.getContactNumber(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package customer; | ||
|
||
import java.util.ArrayList; | ||
|
||
public class CustomerList { | ||
|
||
public static ArrayList<Customer> customers = new ArrayList<>(); | ||
|
||
public static void addCustomer(Customer customer){ | ||
customers.add(customer); | ||
System.out.println("Customer added"); | ||
System.out.println(customer.toString()); | ||
} | ||
|
||
public static boolean removeCustomer(String username){ | ||
for(Customer customer : customers){ | ||
if(customer.getUsername().equals(username)){ | ||
customers.remove(customer); | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
|
||
public static ArrayList<Customer> getCustomers() { | ||
return customers; | ||
} | ||
|
||
public static void printCustomers() { | ||
for (Customer customer : customers) { | ||
System.out.println(customer.toString()); | ||
System.out.println("____________________________________________________________"); | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package exceptions; | ||
|
||
public class CarException extends RuntimeException{ | ||
|
||
private static final String ADD_CAR_FORMAT = "add-car /n [CAR_MODEL] /c [CAR_ID] /p [PRICE]"; | ||
|
||
public CarException(String message) { | ||
super(message); | ||
} | ||
|
||
public static CarException addCarException() { | ||
String message = "Unable to add car.. Refer to correct format below:\n" + | ||
ADD_CAR_FORMAT; | ||
return new CarException(message); | ||
} | ||
|
||
public static CarException invalidPrice() { | ||
String message = "Unable to add car.. Price cannot be negative!!"; | ||
return new CarException(message); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package exceptions; | ||
|
||
public class CliRentalException extends Exception { | ||
public CliRentalException(String message) { | ||
super(message); | ||
} | ||
public static CliRentalException unknownCommand() { | ||
return new CliRentalException("OOPS!!! Invalid command!"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package exceptions; | ||
|
||
/** | ||
* Customer related exceptions | ||
*/ | ||
public class CustomerException extends RuntimeException { | ||
|
||
public static final String ADD_FORMAT = "add-user /u [USERNAME] /a [AGE] /c [CONTACT_NUMBER]"; | ||
|
||
public CustomerException(String message) { | ||
super(message); | ||
} | ||
|
||
public void printErrorMessage(){ | ||
System.out.println(getMessage()); | ||
} | ||
|
||
/** | ||
* Exception for the add-user command | ||
*/ | ||
public static CustomerException addCustomerException(){ | ||
return new CustomerException("Unable to add customer. Please follow : " + ADD_FORMAT); | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent naming through the codebase: customers v.s. carsList.
It would be good if this is consistent throughout the codebase.