adding bank
This commit is contained in:
@@ -3,26 +3,23 @@ package main
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
var revenue float64
|
||||
var expenses float64
|
||||
var taxRate float64
|
||||
revenue := getUserInput("Revenue: ")
|
||||
expenses := getUserInput("Expenses: ")
|
||||
taxRate := getUserInput("Tax Rate: ")
|
||||
|
||||
fmt.Print("Revenue: ")
|
||||
fmt.Scan(&revenue)
|
||||
ebt, profit, ratio := calculateFinancials(revenue, expenses, taxRate)
|
||||
|
||||
|
||||
fmt.Print("Expenses: ")
|
||||
fmt.Scan(&expenses)
|
||||
|
||||
fmt.Print("Tax Rate: ")
|
||||
fmt.Scan(&taxRate)
|
||||
fmt.Printf("%.1f\n", ebt)
|
||||
fmt.Printf("%.1f\n", profit)
|
||||
fmt.Printf("%.3f", ratio)
|
||||
}
|
||||
|
||||
func calculateFinancials(revenue, expenses, taxRate float64) (float64, float64, float64) {
|
||||
ebt := revenue - expenses
|
||||
profit := ebt * (1 - taxRate/100)
|
||||
ratio := ebt / profit
|
||||
|
||||
fmt.Println(ebt)
|
||||
fmt.Println(profit)
|
||||
fmt.Println(ratio)
|
||||
return ebt, profit, ratio
|
||||
}
|
||||
|
||||
func getUserInput(infoText string) float64 {
|
||||
|
||||
Reference in New Issue
Block a user