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

Projeto finalizado #14

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
  •  
  •  
  •  
10 changes: 7 additions & 3 deletions app.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import { CompanyAccount } from './class/CompanyAccount'
import { NewAccount } from './class/NewAccount'
import { PeopleAccount } from './class/PeopleAccount'

const peopleAccount: PeopleAccount = new PeopleAccount(1, 'Nath', 10)
peopleAccount.deposit(100)
console.log(peopleAccount)
peopleAccount.deposit()
const companyAccount: CompanyAccount = new CompanyAccount('DIO', 20)
companyAccount.deposit()
console.log(companyAccount)
companyAccount.getLoan(200)
console.log(companyAccount)
const newAccount = new NewAccount('Josias', 30)
newAccount.deposit(300)
console.log(newAccount)
7 changes: 5 additions & 2 deletions 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 => {
console.log('Voce pegou um empréstimo')
getLoan = (valEmprestimo: number): void => {
if (this.validateStatus()) {
this.balance += valEmprestimo
console.log(`Parabéns! Voce pegou um empréstimo de R$${valEmprestimo}.`)
}
}
}
16 changes: 11 additions & 5 deletions class/DioAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,27 @@ export abstract class DioAccount {
return this.name
}

deposit = (): void => {
deposit = (valorDeposito: number): void => {
if(this.validateStatus()){
console.log('Voce depositou')
this.balance += valorDeposito;
console.log(`Sucesso! Você depositou R$${valorDeposito}.`)
}
}

withdraw = (): void => {
console.log('Voce sacou')
withdraw = (valorSaque: number): void => {
if(this.validateStatus() && this.balance > valorSaque){
this.balance -= valorSaque;
console.log(`Sucesso! Você sacou R$${valorSaque}.`)
} else {
console.log('Falha na transição. Você não possui saldo suficiente.')
}
}

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

private validateStatus = (): boolean => {
protected validateStatus = (): boolean => {
if (this.status) {
return this.status
}
Expand Down
11 changes: 11 additions & 0 deletions class/NewAccount.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { DioAccount } from "./DioAccount";

export class NewAccount extends DioAccount {
constructor(name: string, accountNumber: number) {
super(name, accountNumber)
}

deposit = (valorDeposito: number): void => {
this.balance += (valorDeposito + 10)
}
}
12 changes: 12 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.

12 changes: 12 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.

12 changes: 12 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.

12 changes: 12 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.

12 changes: 12 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.

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

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

12 changes: 12 additions & 0 deletions node_modules/.bin/ts-node

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

Loading