Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import "fmt"
- func main() {
- var town string
- fmt.Scanln(&town)
- var profit float64
- fmt.Scanln(&profit)
- var commission = 0.0
- if (town == "Sofia") {
- if (profit > 0 && profit <= 500) {
- commission = 0.05
- } else if (profit > 500 && profit <= 1000) {
- commission = 0.07
- } else if (profit > 1000 && profit <= 10000) {
- commission = 0.08
- } else if (profit > 10000) {
- commission = 0.12
- }
- } else if (town == "Varna") {
- if (profit > 0 && profit <= 500) {
- commission = 0.045
- } else if (profit > 500 && profit <= 1000) {
- commission = 0.075
- } else if (profit > 1000 && profit <= 10000) {
- commission = 0.1
- } else if (profit > 10000) {
- commission = 0.13
- }
- } else if (town == "Plovdiv") {
- if (profit > 0 && profit <= 500) {
- commission = 0.055
- } else if (profit > 500 && profit <= 1000) {
- commission = 0.08
- } else if (profit > 1000 && profit <= 10000) {
- commission = 0.12
- } else if (profit > 10000) {
- commission = 0.145
- }
- }
- var sum = profit * commission
- if (sum > 0) {
- fmt.Printf("%.2f\n", sum)
- } else {
- fmt.Println("error")
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement