Skip to content
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

RENAN MARINHO SANTOS #19

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
4 changes: 2 additions & 2 deletions app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { PeopleAccount } from './class/PeopleAccount'

const peopleAccount: PeopleAccount = new PeopleAccount(1, 'Nath', 10)
console.log(peopleAccount)
peopleAccount.deposit()
peopleAccount.deposit(100)
const companyAccount: CompanyAccount = new CompanyAccount('DIO', 20)
companyAccount.deposit()
companyAccount.deposit(101)
console.log(companyAccount)
5 changes: 4 additions & 1 deletion class/CompanyAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ export class CompanyAccount extends DioAccount {
super(name, accountNumber)
}

getLoan = (): void => {
getLoan = (amount: number): void => {
if (this.validateStatus()){
this.deposit(amount)
}
console.log('Voce pegou um empréstimo')
}
}
18 changes: 13 additions & 5 deletions class/DioAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,33 @@ export abstract class DioAccount {
return this.name
}

deposit = (): void => {
deposit = (amount: number): void => {
this.balance += amount
if(this.validateStatus()){
console.log('Voce depositou')
console.log('Voce depositou' + amount)
}
}

withdraw = (): void => {
console.log('Voce sacou')
withdraw = (amount: number): void => {
this.balance -= amount
if(this.validateStatus() && this.balance >= amount){
console.log('Voce sacou' + amount)
}else{
console.log('Saldo insuficiente')
}

}

getBalance = (): void => {
console.log(this.balance)
}

private validateStatus = (): boolean => {
public validateStatus = (): boolean => {
if (this.status) {
return this.status
}

throw new Error('Conta inválida')
}
}

35 changes: 35 additions & 0 deletions class/PersonalAccount.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
class PersonalAccount {
private name: string
private accountnumber : number
private balance: number = 0


constructor (name: string, accountnumber: number){
this.name = name
this.accountnumber = accountnumber
}

deposit(amount: number): void{
this.balance += amount
}

getName(): string{
return this.name
}

getBalance(): number{
return this.balance
}


}

class getAccount extends PersonalAccount{
deposit(amount: number): void {
super.deposit(amount)
}
}

const account = new getAccount("Nathaly",659)
account.deposit(100)
console.log(`Saldo de ${account.getName()}: R$ ${account.getBalance()}`)
16 changes: 16 additions & 0 deletions node_modules/.bin/acorn

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions node_modules/.bin/acorn.cmd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions node_modules/.bin/acorn.ps1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions node_modules/.bin/mkdirp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions node_modules/.bin/mkdirp.cmd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions node_modules/.bin/mkdirp.ps1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions node_modules/.bin/resolve

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions node_modules/.bin/resolve.cmd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions node_modules/.bin/resolve.ps1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions node_modules/.bin/rimraf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions node_modules/.bin/rimraf.cmd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions node_modules/.bin/rimraf.ps1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions node_modules/.bin/tree-kill

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions node_modules/.bin/tree-kill.cmd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading